0
点赞
收藏
分享

微信扫一扫

nexttick简易应用

是她丫 2022-03-26 阅读 65
vue.jsjs

作用:获取dom更新

基本操作:
 


<button id="firstBtn" @click="testClick()" ref="button">{{msg}}</button>


methods:{
    testClick:()=>{
      this.msg="修改后的值";
      //that.$refs.button获取指定DOM
      console.log(that.$refs.button.innerText);   //输出原始值
      this.$nextTick(()=>{
        console.log(that.$refs.button.innerText);  //修改后的值
    }
 }
举报

相关推荐

0 条评论