1.采用ES6的import … from …语法

CommonJS的require()方法引入组件

2.对组件进行注册,代码如下
注册

Vue.component('my-component',
{  template: '<div>A custom component!</div>'})

3.使用组件

<my-component></my-component>
Logo

前往低代码交流专区

更多推荐