async getComponent(name = 'job-content-records') {
console.log('进到这里了吗')
var context = await require.context('@/components', true, /\index.vue$/)
var keys = context.keys()
// console.log(keys, '文件类型')
const moduleName = keys.find(key=> key.includes(name));
// console.log(moduleName, '得到了组件路径')
var myComponent = moduleName ? context(moduleName).default : null;
// console.log(myComponent, '组件得到了')
const vueComponent = await Vue.component(name, myComponent);
console.log(vueComponent, '得到了注册的组件')
},
以上是页面局部注册组件,在h5页面是可以展示组件的,在app端组件是不显示的
1***@qq.com (作者)
component是显示支持的
2023-08-09 17:30