this.$nextTick

<template>
  <div class="hello">
    <div>
      <button id="firstBtn" ref="aa">{{testMsg}}</button>
    </div>
  </div>
</template>
 
<script>
export default {
  name: "HelloWorld",
  data() {
    return {
      testMsg: "原始值"
    };
  },
  created() {},
  mounted() {
    let that = this;
    that.$refs.aa.innerHTML = "sss";
    that.$nextTick(function() {
      console.log(that.$refs.aa.innerHTML);
    });
  },
  methods: {}
};
</script>


Logo

前往低代码交流专区

更多推荐