开发说明
组件开发
- 目录:
package - 示例:
package/demo
注册组件
package/index.ts 中注册
ts
let componentList = [MyComponent, TestComponent] // 组件引入
componentList.forEach(comp => {
const c = comp as any
c.install = function (app: App) {
app.component(c.name, comp)
}
})
export { MyComponent, TestComponent } // 组件导出let componentList = [MyComponent, TestComponent] // 组件引入
componentList.forEach(comp => {
const c = comp as any
c.install = function (app: App) {
app.component(c.name, comp)
}
})
export { MyComponent, TestComponent } // 组件导出打包及上传
- 上传前需要打包更新库文件(lib/index.js)
- 修改 package.json 中版本号
- 运行打包命令
bash
pnpm run buildpnpm run build- 上传 git
- 通知其他项目更新组件