注册组件并在页面中使用
1.在component文件夹下增加:
2.在src/component/index.js中增加:
import ActivityInfo from ‘./activityInfo’
Vue.component(“activity-Info”, ActivityInfo);
3.增加引用页面:
4.在router/admin/index.js中增加:
ActivityInfo: {
path: “/activityInfoTest”,
layout: “empty”,
component: () => import("@p/Modules/ActivityInfoTest")
}
5.在ActivityInfoTest/page.vue中导入组件,代码如下:
6.在ActivityInfoTest/page.vue中写入:
7.编译后就可以见到页面上显示:
8.总结:
准备组件、注册组件、准备页面、注册页面、在页面中使用组件