我希望在我的项目中添加一个vue面板:在文档中添加一个vue-黑色仪表板:
Vue黑色仪表板是作为Vue插件构建的,因此您可以简单地导入并使用它。
import Vue from 'vue';
import DashboardPlugin from '@/plugins/blackDashboard'
Vue.use(DashboardPlugin);但是我不知道在哪里粘贴vue-黑色仪表板文件夹,如何将它导入到我的项目中,谢谢。
发布于 2019-12-15 07:44:26
如果您想导入它并在local component中使用它,只需在component中导入它。
<script>
import Vue from 'vue';
import DashboardPlugin from '@/plugins/blackDashboard'
Vue.use(DashboardPlugin);
export default {
}
</script>如果您想导入它并在全局使用它,只需在main.js中导入它。
import Vue from 'vue';
import DashboardPlugin from '@/plugins/blackDashboard'
Vue.use(DashboardPlugin);发布于 2019-12-15 11:18:14
你好,谢谢你的答复
import DashboardPlugin from '@/plugins/blackDashboard'这个地址里的@在哪里?当我在中导入项目时,我希望在指定的路由中使用该模板
找不到这种依赖关系:
要安装它,您可以运行: npm安装--保存@/plugins/blackDashboard
发布于 2022-07-26 09:28:19
你的插件文件看起来怎么样?在/plugins目录中的单独文件中有插件并将它们导入到main.js中也有类似的问题。
我试图实现的是更好的插件结构,将它们保存在文件夹插件中的单独文件中,而不是将所有代码存储在main.js中,不确定是否允许使用,或者这是否是一个很好的实践。
Plugins文件夹:plugins/tosanfication.js
import Vue from 'vue'
import Toast from 'vue-toastification'
import 'vue-toastification/dist/index.css'
const options = {
position: 'bottom-right'
}
Vue.use(Toast, options)
// export default new Toast() - got error while exporting but it works somehow without export default I don't know why部分main.js
// plugins
import vuetify from './plugins/vuetify'
import i18n from './plugins/i18n'
import toastification from './plugins/toastification'
import logger from './plugins/logger'
new Vue({
vuetify,
i18n,
toastification,
logger,
render: h => h(App)
}).$mount('#app')https://stackoverflow.com/questions/59337335
复制相似问题