vue3 的单文件中的命名空间组件具体是什么?

看vue3的API文档

vue3 的单文件中的命名空间组件具体是什么?

文档地址

上面这一节有点儿不是很明白
主要是 import * as Form from './form-components'
这里的 form-components 的是指一个文件夹还是一个文件?

如果是文件,该文件应该是怎么写的呢?


回答:

define
vue3 的单文件中的命名空间组件具体是什么?
use
vue3 的单文件中的命名空间组件具体是什么?


回答:

/form-components 优先级从上到下
  1. /form-components.vue
  2. /form-components/index.js
  3. /form-components/index.vue


回答:

文件夹或者文件都可以
/form-components/index.vue
/form-components.vue


回答:

form-components 是指一个文件夹,当引入的是一个名字为index的js或vue文件时可以省去form-components/后面的index文件名,当这个文件夹下index.js和index.vue两个都存在的时候,则默认为引入的是form-components/index.js

以上是 vue3 的单文件中的命名空间组件具体是什么? 的全部内容, 来源链接: utcz.com/p/936929.html

回到顶部