vue 動態載入元件

lsj1992g發表於2019-03-14
<div v-for="item in comList">
   <component :is="'com'+item"></component>
</div>
<script>
import com1 from './1'
import com2 from './2'
import com3 from './3'
export default {
  components: {
    RuleForm,
    com1,
    com2,
    com3
  },
  data: {
    return {
      comList: [1, 2, 3]
    }
  }
}

</script>
複製程式碼

相關文章