我有一个自定义的Vue-Component,位于Laravel的默认路径。
所以,我安装了 Laravel-Nova 并想在视图中使用该组件的部分。
<dropdown-menu slot="menu" width="200" direction="rtl">
<my-component></my-component>
<ul class="list-reset">
<li>
...
我应该在哪里导入组件?换句话说,我应该把它放在哪里?
import MyComponent from '/path/to/my/component/MyComponent.vue'
//and
Vue.component('my-component', MyComponent)
我想以某种方式来做, 我可以在Vue组件的代码里面使用Nova JavaScript Helpers, 比如说:
this.$toasted.show('It worked!', { type: 'success' })
//or
axios.get('/nova-vendor/stripe-inspector/endpoint').then(response => {
// ...
})
这是一个类似组件的例子:
import MyLens from './components/views/Lens';
Nova.booting((Vue, router, store) => {
router.addRoutes([{
name: 'nova-improvements',
path: '/nova-improvements',
component: require('./components/Tool'),
}])
});
Nova.booting((Vue, router, store) => {
Vue.component('lens', MyLens)
});