Live2d Test Env

vue使用ref方式获取antdv-button点击的方法

用antdv的v-decorator方式绑定数据,初始化时需要向后台发起一次请求

需要在mounted函数里使用
且要在nextTick()函数内

PS:

  mounted() {
     this.$nextTick(()=>this.initList())
    //  console.log('this.$refs.getList  :>> ', this.$refs.getList );
    //  也可以使用ref方式操作点击事件
    // a-button click ==  this.$refs.buttonComp handleClick
    //  this.$nextTick(()=>this.$refs.buttonComp.handleClick())
  },

由于decorator是基于dom的,所以要在mounted里使用,created内是不能使用的

posted @ 2021-12-10 11:36  致爱丽丝  阅读(217)  评论(0)    收藏  举报