| import createButton from "./index.vue"; | ||
| createButton.install = (app) => { | ||
| app.component(createButton.name, createButton); | ||
| import { App } from "vue"; | ||
| createButton.install = (app: App) => { | ||
| app.component(createButton.name || "", createButton); | ||
| return app; | ||
@@ -5,0 +6,0 @@ }; |
| <template> | ||
| <div> | ||
| <button>我是测试按钮</button> | ||
| <button @click="handleClick">我是测试按钮</button> | ||
| <div>点击次数:{{ count }}</div> | ||
| </div> | ||
@@ -8,2 +9,7 @@ </template> | ||
| //上面的name="create-button"是组件名必须填写,他决定了在其他项目中引入此组件的名称 | ||
| import { ref } from "vue"; | ||
| const count = ref(0); | ||
| const handleClick = () => { | ||
| count.value++; | ||
| }; | ||
| </script> | ||
@@ -10,0 +16,0 @@ <style scoped> |
+3
-2
@@ -0,6 +1,7 @@ | ||
| import { App } from "vue"; | ||
| import createButton from "./components/button/index.vue"; //导入写好的组件 | ||
| const components = [createButton]; //所有的组件都放这个数组里 | ||
| const install = (app) => { | ||
| const install = (app: App) => { | ||
| for (const item of components) { | ||
| app.component(item.name, item); //批量注册组件 | ||
| app.component(item.name || "", item); //批量注册组件 | ||
| } | ||
@@ -7,0 +8,0 @@ return app; |
+7
-1
| { | ||
| "name": "zin-ui", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "description": "zxw组件库", | ||
@@ -13,3 +13,9 @@ "author": { | ||
| "registry": "https://registry.npmjs.org/" | ||
| }, | ||
| "scripts": { | ||
| "build": "echo '构建组件库...'", | ||
| "test": "echo '运行测试...'", | ||
| "dev": "echo '开发模式...'", | ||
| "prepare": "echo '准备环境...'" | ||
| } | ||
| } |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
1650
33.39%17
13.33%2
-33.33%