我正在尝试在我创建的自定义 vue 插件中使用 vuetify 组件,但似乎我的插件在应用程序“知道”存在 vuetify 之前呈现。
我曾尝试在我的插件中使用 Vue.use(Vuetify),但它不起作用,基本上,在我的插件中使用它没有意义,因为我希望插件用户(开发人员)将 vuetify 用作全局依赖项在他的应用程序中,这样它就可以渗透到我的插件中
这是我的插件的 vue html 模板:
<v-content>
<v-container fluid fill-height>
<v-layout justify-center>
<div v-if="videoLoading">
<v-progress-circular v-if="useVuetifyLoader"
:size="size"
:width="width"
:rotate="rotate"
:value="videoLoadingProgress*1.5"
:color="color"
>
Downloading...
{{ `${loadedInMB}/${totalInMb}Mb` }}
</v-progress-circular>
<div v-else>
Downloading...
{{ `${loadedInMB}/${totalInMb}Mb` }}
</div>
</div>
<div v-else>
<div>
<div>foo</div>
</div>
</div>
</v-layout>
</v-container>
</v-content>
这是我的插件:
import MyPlugin from '../lib/MyPlugin.vue';
import Vuetify from 'vuetify'
const install = function (Vue, config) {
Vue.component("my-plugin", MyPlugin)
}
export { install }
*and i tried also :*
import MyPlugin from '../lib/MyPlugin.vue';
import Vuetify from 'vuetify'
const install = function (Vue, config) {
Vue.use(Vuetify)// <-- did not work
Vue.component("my-plugin", MyPlugin)
}
export { install }
当我在其他应用程序中实现我的插件时,我遇到了这些错误:
Unknown custom element: <v-content> - did you register the component correctly? For recursive components, make sure to provide the "name" option
Unknown custom element: <v-container> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
Unknown custom element: <v-layout> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
Unknown custom element: <v-progress-circular> - did you register the component correctly? For recursive components, make sure to provide the "name" option.