如何正确使用Vue.js的组件

2025-05-08 21:01:32
推荐回答(1个)
回答1:

index.html 修改为如下:




cityList


111






app.js 修改为如下:

var Vue = require('vue');
var App = require('./app.vue'); // 返回的是一个组件,必须注册才能使用
new Vue({
el:'body',
components:{
app: App
}
});