你好,你能帮我把它转换成Vue3的javascript吗?谢谢
import type { App } from 'vue'
import Screenfull from './Screenfull.vue'
const components = [
Screenfull,
]
const install = (app: App): void => {
components.forEach(component => {
app.component(component.name, component)
})
}
export default install发布于 2021-01-31 07:16:19
您的插件循环遍历一组组件,并使用组件的name属性全局注册它们。因此,请确保以这种方式注册的每个组件都有一个name属性:
Dashboard.vue
<template>
<div>My component</div>
</template>export default {
name: 'Dashboard' // ✅ Add this
}从install函数中删除输入:
const install = (app) => {
components.forEach(component => {
app.component(component.name, component)
})
}移除这一行:
import type { App } from 'vue'https://stackoverflow.com/questions/65975456
复制相似问题