btxui 1.0.1 → 1.0.2

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.
Files changed (3) hide show
  1. package/main.js +12 -2
  2. package/package.json +1 -1
  3. package/pages/index.vue +15 -1
package/main.js CHANGED
@@ -1,6 +1,16 @@
1
+ // const initGlobalComponents: GlobalType.IRecord = import.meta.glob("@/components/BTXUI/core/*/*.vue");
2
+ const styles: GlobalType.IRecord = import.meta.glob("@/components/BTXUI/core/styles/index.vue");
3
+ const bView: GlobalType.IRecord = import.meta.glob("@/components/BTXUI/core/b-view/index.vue");
4
+ const initGlobalComponents = { ...styles, ...bView } as any;
5
+
1
6
  export default {
2
7
  name: "btxui",
3
- show() {
4
- return "BTX",
8
+ install(app){
9
+ // 注册全局组件
10
+ Object.keys(initGlobalComponents).forEach(path => {
11
+ const pathBlocks = path.split("/");
12
+ pathBlocks.pop();
13
+ app.component(pathBlocks.pop() as string, initGlobalComponents[path]);
14
+ })
5
15
  }
6
16
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "btxui",
3
3
  "private": false,
4
- "version": "1.0.1",
4
+ "version": "1.0.2",
5
5
  "main": "main.js",
6
6
  "scripts": {
7
7
  "build": "nuxt build --dotenv .env.production",
package/pages/index.vue CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  <template>
2
3
  <article>
3
4
  <p class="pcenter-s">
@@ -26,4 +27,17 @@
26
27
  <p>全局样式秉持 web 开发传统的 "样式复用" 理念,而组件应用则推崇新兴的 "组件复用" 理念,根据实际应用场景可以选择不同的开发模式。此外,全局样式也可以与组件进行混合使用。</p>
27
28
  </section>
28
29
  </article>
29
- </template>
30
+ </template>
31
+
32
+ <script setup lang="ts">
33
+ // const btxuiComponents = {} as any;
34
+ // const styles: GlobalType.IRecord = import.meta.glob("@/components/BTXUI/core/styles/index.vue");
35
+ // const bView: GlobalType.IRecord = import.meta.glob("@/components/BTXUI/core/b-view/index.vue");
36
+ // const initGlobalComponents = { ...styles, ...bView } as any;
37
+ // // const initGlobalComponents: GlobalType.IRecord = import.meta.glob("@/components/BTXUI/core/*/*.vue");
38
+ // Object.keys(initGlobalComponents).forEach(path => {
39
+ // const pathBlocks = path.split("/");
40
+ // pathBlocks.pop();
41
+ // btxuiComponents[pathBlocks.pop() as string] = initGlobalComponents[path];
42
+ // })
43
+ </script>