nbb-component-ui 1.0.4 → 1.0.6

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.
package/index.js CHANGED
@@ -1,12 +1,10 @@
1
- import MyButton from './src/MyButton.vue'
2
1
  import {ProcessFlow} from "./src/ProcessFlow";
3
2
 
4
3
  // 支持全局注册
5
4
  const install = (app) => {
6
- app.component('MyButton', MyButton)
7
5
  app.component('ProcessFlow', ProcessFlow)
8
6
  }
9
7
  // 支持按需引入
10
- export { MyButton, ProcessFlow }
8
+ export {ProcessFlow }
11
9
  // 默认导出(全局注册用)
12
10
  export default { install }
package/package.json CHANGED
@@ -1,15 +1,31 @@
1
1
  {
2
2
  "name": "nbb-component-ui",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
- "build": "vite build"
6
+ "build": "vite build"
7
7
  },
8
- "author": "",
8
+ "author": "胡鹏",
9
9
  "license": "ISC",
10
10
  "description": "",
11
11
  "devDependencies": {
12
- "@vitejs/plugin-vue": "^6.0.5",
13
- "vite": "^8.0.3"
12
+ "@vitejs/plugin-vue": "^4.0.0",
13
+ "element-plus": "^2.0.0",
14
+ "typescript": "^5.0.0",
15
+ "vite": "^4.0.0",
16
+ "vue": "^3.2.0",
17
+ "vue-tsc": "^1.0.0"
18
+ },
19
+ "peerDependencies": {
20
+ "element-plus": "^2.13.6",
21
+ "vue": "^3.0.0"
22
+ },
23
+ "peerDependenciesMeta": {
24
+ "vue": {
25
+ "optional": false
26
+ },
27
+ "element-plus": {
28
+ "optional": false
29
+ }
14
30
  }
15
31
  }
package/vite.config.js CHANGED
@@ -1,20 +1,26 @@
1
1
  import { defineConfig } from 'vite'
2
2
  import vue from '@vitejs/plugin-vue'
3
+ import { resolve } from 'path'
3
4
 
4
5
  export default defineConfig({
5
6
  plugins: [vue()],
6
-
7
7
  build: {
8
8
  lib: {
9
- entry: 'index.js',
10
- name: 'MyComponent',
11
- fileName: 'index'
9
+ entry: resolve(__dirname, 'index.js'),
10
+ name: 'NbbComponentUi',
11
+ fileName: (format) => `index.${format}.js`,
12
+ formats: ['es', 'umd']
12
13
  },
13
14
  rollupOptions: {
14
- external: ['vue'],
15
+ // 【关键】外部化vue和element-plus,不打包进组件库
16
+ external: ['vue', 'element-plus'],
15
17
  output: {
16
- globals: { vue: 'Vue' }
18
+ // UMD模式下的全局变量名
19
+ globals: {
20
+ vue: 'Vue',
21
+ 'element-plus': 'ElementPlus'
22
+ }
17
23
  }
18
24
  }
19
25
  }
20
- })
26
+ })
package/dist/index.css DELETED
@@ -1,2 +0,0 @@
1
- .my-btn[data-v-8e812d17]{color:#fff;cursor:pointer;border:none;border-radius:4px;padding:8px 16px}
2
- /*$vite$:1*/
package/dist/index.mjs DELETED
@@ -1,25 +0,0 @@
1
- import { createElementBlock as e, normalizeStyle as t, openBlock as n, renderSlot as r } from "vue";
2
- var i = /* @__PURE__ */ ((e, t) => {
3
- let n = e.__vccOpts || e;
4
- for (let [e, r] of t) n[e] = r;
5
- return n;
6
- })({
7
- __name: "MyButton",
8
- props: { bgColor: {
9
- type: String,
10
- default: "#409eff"
11
- } },
12
- emits: ["click"],
13
- setup(i, { emit: a }) {
14
- let o = a, s = () => o("click");
15
- return (a, o) => (n(), e("button", {
16
- class: "my-btn",
17
- style: t({ backgroundColor: i.bgColor }),
18
- onClick: s
19
- }, [r(a.$slots, "default", {}, void 0, !0)], 4));
20
- }
21
- }, [["__scopeId", "data-v-8e812d17"]]), a = { install: (e) => {
22
- e.component("MyButton", i);
23
- } };
24
- //#endregion
25
- export { i as MyButton, a as default };
package/dist/index.umd.js DELETED
@@ -1 +0,0 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MyComponent={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})({__name:`MyButton`,props:{bgColor:{type:String,default:`#409eff`}},emits:[`click`],setup(e,{emit:n}){let r=n,i=()=>r(`click`);return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{class:`my-btn`,style:(0,t.normalizeStyle)({backgroundColor:e.bgColor}),onClick:i},[(0,t.renderSlot)(n.$slots,`default`,{},void 0,!0)],4))}},[[`__scopeId`,`data-v-8e812d17`]]);e.MyButton=n,e.default={install:e=>{e.component(`MyButton`,n)}}});
package/src/MyButton.vue DELETED
@@ -1,32 +0,0 @@
1
- <template>
2
- <button class="my-btn" :style="{ backgroundColor: bgColor }" @click="handleClick">
3
- <slot></slot>
4
- </button>
5
- </template>
6
-
7
- <script setup>
8
- import { defineProps, defineEmits } from 'vue'
9
- // 定义props
10
- const props = defineProps({
11
- bgColor: {
12
- type: String,
13
- default: '#409eff'
14
- }
15
- })
16
- // 定义事件
17
- const emit = defineEmits(['click'])
18
- const handleClick = () => {
19
- console.log('我被点击了')
20
- emit('click')
21
- }
22
- </script>
23
-
24
- <style scoped>
25
- .my-btn {
26
- padding: 8px 16px;
27
- border: none;
28
- border-radius: 4px;
29
- color: white;
30
- cursor: pointer;
31
- }
32
- </style>