我有一个文件,我有一个像这样注册的组件(/tables/mytable.ts):
import Vue from "vue";
Vue.component('my-table', {
template: "<p>mycomponent</p>"
});
我想要使用我的组件(myvue.ts)的第二个文件:
import Vue from "vue";
// these two ways bellow don't working too
//import myTable from 'my-table'
//import { MyComponent } from '/tables/mytable.ts';
let v = new Vue({
el: "#tabForUsers",
template: "<my-table></my-table>"
});
我收到错误:
Unknown custom element: <my-table> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
在webpack中我分别拥有每个ts文件。