最近在开发中需要用到动态设置ref的内容,摸索了很久终于弄明白了要怎么实现。
<fcEditor ref="myeditor"></fcEditor>
this.$refs.myeditor;
  data () {
    return {
      steps:[
        {name:‘itemName‘,title:"step1",id:1,content:"步骤一",orderNumber:1},
        {name:‘itemName‘,title:"step2",id:2,content:"步骤二",orderNumber:2},
        {name:‘itemName‘,title:"step3",id:3,content:"步骤三",orderNumber:3}]
    }
  }
      <itemBox style="" class="itembox" v-for="item in steps" :key="item.id" :ref="item.name">
      </itemBox>
this.$refs.itemName[0]
原文:https://www.jianshu.com/p/8617f8852df7
Vue使用v-for时动态绑定ref(v-for组件内使用ref)
原文:https://www.cnblogs.com/mmzuo-798/p/12307634.html