<template>
  <div>
    <div v-for="(item,index) in items"
         :key="index">
       <div class="cItem" @click="onClickItem(item.name)">{{item.name}}</div>
    </div>
  </div>
</template>

<script>

import YxSys from "../../../../utils/platform/index"

export default {
  data () {
    return {
      items:[
        {name:'getSystemInfo'},
        {name:'stopRefresh'},
        {name:'showLoading'},
        {name:'toast'},
        {name:'toast3'},
        {name:'showConfirmDialog'},
      ],
    }
  },

  components: {
  },

  methods: {
    onClickItem (name) {
       if(name == 'getSystemInfo'){
          YxSys.getSystemInfo((info)=>{
            console.log(info)
          })
       }else if(name == 'stopRefresh'){
          YxSys.stopRefresh()
       }else if(name == 'showLoading'){
          YxSys.showLoading(true,"showloading,1s stop")
          setTimeout(()=>{
             YxSys.showLoading(false)
          },1000)
       }else if(name == 'toast'){
          YxSys.toast("info")
       }else if(name == 'toast3'){
         YxSys.toast("info 3 second",3)
       }
       else if(name == 'showConfirmDialog'){
          YxSys.showConfirmDialog('确认按钮', 'this is a dialog',()=>{
             console.log("confirm")
          })
       }
    },

    exMothod(){
      try{
        var tt = null;
        console.log(tt.name)
      }catch (err){
        throw (err)
      }
    }
  },

  created () {
    // let app = getApp()
  }
}
</script>

<style scoped>
  .cItem{
     width: 100%;
     line-height: 40px;
     padding-left: 10px;
     border-bottom: solid 1px #959595;
  }
</style>
