@star-ai/star-ui 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
 
2
2
  import StarButton from './StarButton.vue'
3
3
 
4
+ // 确保组件有install方法
4
5
  StarButton.install = function(Vue) {
5
6
  Vue.component(StarButton.name, StarButton)
6
7
  }
@@ -1,6 +1,7 @@
1
1
 
2
2
  import StarInput from './StarInput.vue'
3
3
 
4
+ // 确保组件有install方法
4
5
  StarInput.install = function(Vue) {
5
6
  Vue.component(StarInput.name, StarInput)
6
7
  }
package/lib/index.js CHANGED
@@ -1,10 +1,18 @@
1
1
 
2
- // 自动导入所有组件
3
- const components = []
2
+ // 导入所有组件
3
+ import StarButton from './components/StarButton'
4
+ import StarInput from './components/StarInput'
4
5
 
6
+ // 组件列表
7
+ const components = [StarButton, StarInput]
8
+
9
+ // 安装函数
5
10
  const install = function(Vue, opts = {}) {
6
11
  components.forEach(component => {
7
- Vue.use(component)
12
+ // 确保组件有name属性和install方法
13
+ if (component.name && component.install) {
14
+ Vue.component(component.name, component)
15
+ }
8
16
  })
9
17
 
10
18
  // 挂载全局方法
@@ -19,10 +27,14 @@ if (typeof window !== 'undefined' && window.Vue) {
19
27
  install(window.Vue)
20
28
  }
21
29
 
30
+ // 导出默认对象
22
31
  export default {
23
- version: '0.1.10',
32
+ version: '0.1.11',
24
33
  install,
25
- // 按需导出所有组件
26
- StarButton: require('./components/StarButton').default,
27
- StarInput: require('./components/StarInput').default
34
+ // 导出所有组件
35
+ StarButton, StarInput
28
36
  }
37
+
38
+ // 按需导出组件
39
+ export { StarButton }
40
+ export { StarInput }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@star-ai/star-ui",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "基于Uniapp的Vue2组件库",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",