【问题标题】:vue single file component - self importvue单文件组件——自导入
【发布时间】:2017-07-11 12:01:04
【问题描述】:

是否有可能导入相同的 SFC?我的意思是:

test.vue:

<template>
  <ul v-for="(item, index) in menuLevel">
    <li>
      {{item.name}}
      <test :data="item" v-if="item.children && item.children.length"></test>
    </li>
  </ul>
</template>

【问题讨论】:

    标签: vue.js


    【解决方案1】:

    是的,您可以在Recursive Components 下的文档中了解它。

    您需要确保在组件选项对象中指定组件的name 并且一切就绪。

    【讨论】:

    • 同时检查无限循环的可能性
    • @VamsiKrishna 我有检查:item.children && item.children.length :)
    猜你喜欢
    • 2019-02-17
    • 2021-06-19
    • 2018-01-16
    • 1970-01-01
    • 2018-06-14
    • 1970-01-01
    • 2017-06-19
    • 1970-01-01
    • 2019-04-23
    相关资源
    最近更新 更多