sccba-ui 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 sccba-ui
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,136 @@
1
+ # sccba-ui
2
+
3
+ 一个基于 Vue 2/3 的 UI 组件库,使用 vue-demi 实现跨版本兼容。
4
+
5
+ ## 特性
6
+
7
+ - 支持 Vue 2.7 和 Vue 3.x
8
+ - 基于 Element UI 和 Element Plus 构建
9
+ - 提供 SccbaButton 和 SccbaInput 组件
10
+ - 使用 TypeScript 友好的 API 设计
11
+
12
+ ## 安装
13
+
14
+ ```bash
15
+ npm install sccba-ui
16
+ ```
17
+
18
+ ## 使用
19
+
20
+ ### Vue 3
21
+
22
+ ```javascript
23
+ import { createApp } from 'vue'
24
+ import { SccbaButton, SccbaInput } from 'sccba-ui'
25
+ import 'sccba-ui/dist/sccba-ui.css'
26
+ import App from './App.vue'
27
+
28
+ const app = createApp(App)
29
+
30
+ app.use(SccbaButton)
31
+ app.use(SccbaInput)
32
+
33
+ app.mount('#app')
34
+ ```
35
+
36
+ ### Vue 2
37
+
38
+ ```javascript
39
+ import Vue from 'vue'
40
+ import { SccbaButton, SccbaInput } from 'sccba-ui'
41
+ import 'sccba-ui/dist/sccba-ui.css'
42
+ import App from './App.vue'
43
+
44
+ Vue.use(SccbaButton)
45
+ Vue.use(SccbaInput)
46
+
47
+ new Vue({
48
+ render: h => h(App)
49
+ }).$mount('#app')
50
+ ```
51
+
52
+ ## 组件
53
+
54
+ ### SccbaButton
55
+
56
+ 按钮组件,支持多种类型和样式。
57
+
58
+ #### Props
59
+
60
+ - `type`: 按钮类型,可选值:`primary`、`success`、`warning`、`danger`、`info`
61
+ - `size`: 按钮尺寸,可选值:`large`、`medium`、`small`
62
+ - `plain`: 是否为朴素按钮
63
+ - `round`: 是否为圆角按钮
64
+ - `circle`: 是否为圆形按钮
65
+ - `disabled`: 是否禁用
66
+
67
+ #### 示例
68
+
69
+ ```vue
70
+ <template>
71
+ <SccbaButton type="primary">主要按钮</SccbaButton>
72
+ <SccbaButton type="success">成功按钮</SccbaButton>
73
+ <SccbaButton type="danger">危险按钮</SccbaButton>
74
+ </template>
75
+ ```
76
+
77
+ ### SccbaInput
78
+
79
+ 输入框组件,支持多种输入类型。
80
+
81
+ #### Props
82
+
83
+ - `type`: 输入框类型,默认为 `text`
84
+ - `placeholder`: 占位符文本
85
+ - `disabled`: 是否禁用
86
+ - `readonly`: 是否只读
87
+ - `clearable`: 是否可清空
88
+ - `showPassword`: 是否显示密码切换按钮
89
+ - `maxlength`: 最大输入长度
90
+ - `showWordLimit`: 是否显示字数统计
91
+
92
+ #### 方法
93
+
94
+ - `focus()`: 聚焦输入框
95
+
96
+ #### 示例
97
+
98
+ ```vue
99
+ <template>
100
+ <SccbaInput ref="inputRef" placeholder="请输入内容" />
101
+ <SccbaButton @click="inputRef.focus()">聚焦输入框</SccbaButton>
102
+ </template>
103
+
104
+ <script setup>
105
+ import { ref } from 'vue'
106
+ const inputRef = ref(null)
107
+ </script>
108
+ ```
109
+
110
+ ## 依赖
111
+
112
+ - vue: ^2.7.0 || ^3.0.0
113
+ - vue-demi: ^0.14.10
114
+ - element-ui: ^2.15.14 (Vue 2)
115
+ - element-plus: ^2.13.0 (Vue 3)
116
+
117
+ ## 开发
118
+
119
+ ```bash
120
+ # 安装依赖
121
+ npm install
122
+
123
+ # 开发模式
124
+ npm run dev
125
+
126
+ # 构建
127
+ npm run build
128
+
129
+ # 切换 Vue 版本
130
+ npm run switch:vue2 # 切换到 Vue 2
131
+ npm run switch:vue3 # 切换到 Vue 3
132
+ ```
133
+
134
+ ## License
135
+
136
+ MIT
@@ -0,0 +1 @@
1
+ "use strict";var b=Object.create;var y=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var _=(e,o,l,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of S(o))!v.call(e,a)&&a!==l&&y(e,a,{get:()=>o[a],enumerable:!(s=B(o,a))||s.enumerable});return e};var f=(e,o,l)=>(l=e!=null?b(h(e)):{},_(o||!e||!e.__esModule?y(l,"default",{value:e,enumerable:!0}):l,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue-demi"),n=require("vue"),d=(e,o)=>{const l=e.__vccOpts||e;for(const[s,a]of o)l[s]=a;return l},I={name:"MyButton",inheritAttrs:!1},w=Object.assign(I,{props:{type:{type:String,default:"default"},size:{type:String,default:""},plain:{type:Boolean,default:!1},round:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},icon:{type:String,default:""},label:{type:String,default:""},width:{type:[String,Number],default:""},height:{type:[String,Number],default:""},block:{type:Boolean,default:!1},nativeType:{type:String,default:"button"},placeholder:{type:String,default:""}},setup(e){const o=e,l=t.useAttrs(),s=t.shallowRef(null),a=t.ref(null),r=t.computed(()=>({...o,...l}));return t.onMounted(async()=>{if(t.isVue2){const u=await import("element-ui");s.value=u.Button}else{const u=await import("element-plus");s.value=u.ElButton}}),(u,i)=>n.unref(s)?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(t.h)(n.unref(s),{...n.unref(r),ref:n.unref(a)},u.$slots)),{key:0})):n.createCommentVNode("",!0)}}),C=d(w,[["__scopeId","data-v-20d033dc"]]),M=t.defineComponent({name:"MyButton",inheritAttrs:!1,props:{type:{type:String,default:"default"},size:{type:String,default:"medium"},plain:{type:Boolean,default:!1},round:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},icon:{type:String,default:""},label:{type:String,default:""},width:{type:[String,Number],default:""},height:{type:[String,Number],default:""},block:{type:Boolean,default:!1},nativeType:{type:String,default:"button"},placeholder:{type:String,default:""}},setup(e,{attrs:o}){const l=t.shallowRef(null),s=t.computed(()=>({...e,...o})),a=t.getCurrentInstance(),r=u=>{console.log(u,"elllll"),u&&(a.exposed=u)};return t.onMounted(async()=>{if(t.isVue2){const u=await import("element-ui");l.value=u.Button}else{const u=await import("element-plus");l.value=u.ElButton}console.log(l.value,"buttonComponent.value"),console.log(a,"vmmmmm")}),{buttonComponent:l,allProps:s,h:t.h,changeRef:r}}});function $(e,o,l,s,a,r){return n.openBlock(),n.createBlock(n.resolveDynamicComponent(e.h(e.buttonComponent,{...e.allProps,ref:e.changeRef},e.$slots)))}const k=d(M,[["render",$],["__scopeId","data-v-1cb31901"]]),P={name:"MyInput"},N=Object.assign(P,{props:{type:{type:String,default:"text"},size:{type:String,default:""},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},maxlength:{type:[String,Number],default:null},showWordLimit:{type:Boolean,default:!1},autocomplete:{type:String,default:"off"},name:{type:String,default:""},form:{type:String,default:""},required:{type:Boolean,default:!1},width:{type:[String,Number],default:""}},emits:["input","change","focus","blur","clear"],setup(e,{expose:o,emit:l}){const s=e,a=t.useAttrs(),r=t.shallowRef(null),u=t.computed(()=>({...s,...a}));t.onMounted(async()=>{if(t.isVue2){const c=await import("element-ui");r.value=c.Input}else{const c=await import("element-plus");r.value=c.ElInput}});const i=t.getCurrentInstance(),p=t.ref(null),g=c=>{p.value=c,t.isVue2&&i&&(i.exposed=c)};return o({getInputInstance:()=>p.value,focus:()=>p.value?.focus(),blur:()=>p.value?.blur(),select:()=>p.value?.select(),clear:()=>p.value?.clear(),inputRef:p}),(c,U)=>n.unref(r)?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(t.h)(n.unref(r),{...n.unref(u),ref:g},c.$slots)),{key:0})):n.createCommentVNode("",!0)}}),R=d(N,[["__scopeId","data-v-db6e0500"]]);function m(e){e.component("SccbaButton",SccbaButton),e.component("MyButton1",MyButton1),e.component("SccbaInput",SccbaInput)}const V={install:m};exports.MyButton1=k;exports.MyUI=V;exports.SccbaButton=C;exports.SccbaInput=R;exports.install=m;
@@ -0,0 +1 @@
1
+ :root{font-family:system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}.card{padding:2em}#app{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}@media(prefers-color-scheme:light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}[data-v-20d033dc] .el-button{transition:all .3s cubic-bezier(.645,.045,.355,1)}[data-v-20d033dc] .el-button:hover{box-shadow:0 4px 12px #00000026;transform:translateY(-1px)}[data-v-20d033dc] .el-button:active{transform:translateY(0);box-shadow:0 2px 8px #00000026}[data-v-20d033dc] .el-button{margin-right:10px}[data-v-20d033dc] .el-button:last-child{margin-right:0}[data-v-1cb31901] .el-button{transition:all .3s cubic-bezier(.645,.045,.355,1)}[data-v-1cb31901] .el-button:hover{box-shadow:0 4px 12px #00000026;transform:translateY(-1px)}[data-v-1cb31901] .el-button:active{transform:translateY(0);box-shadow:0 2px 8px #00000026}[data-v-1cb31901] .el-button{margin-right:10px}[data-v-1cb31901] .el-button:last-child{margin-right:0}[data-v-db6e0500] .el-input__inner{transition:all .3s cubic-bezier(.645,.045,.355,1)}[data-v-db6e0500] .el-input__inner:focus{box-shadow:0 0 0 2px #3b82f633!important}
@@ -0,0 +1,312 @@
1
+ import { useAttrs as _, shallowRef as i, ref as h, computed as d, onMounted as y, isVue2 as c, h as m, defineComponent as $, getCurrentInstance as v } from "vue-demi";
2
+ import { createBlock as g, createCommentVNode as I, unref as u, openBlock as b, resolveDynamicComponent as B } from "vue";
3
+ const S = (e, s) => {
4
+ const n = e.__vccOpts || e;
5
+ for (const [o, l] of s)
6
+ n[o] = l;
7
+ return n;
8
+ }, C = {
9
+ name: "MyButton",
10
+ inheritAttrs: !1
11
+ }, M = /* @__PURE__ */ Object.assign(C, {
12
+ props: {
13
+ // 类型:primary/success/warning/danger/info/text
14
+ type: {
15
+ type: String,
16
+ default: "default"
17
+ },
18
+ // 尺寸:large/medium/small/mini
19
+ size: {
20
+ type: String,
21
+ default: ""
22
+ },
23
+ // 是否朴素按钮
24
+ plain: {
25
+ type: Boolean,
26
+ default: !1
27
+ },
28
+ // 是否圆角按钮
29
+ round: {
30
+ type: Boolean,
31
+ default: !1
32
+ },
33
+ // 是否圆形按钮
34
+ circle: {
35
+ type: Boolean,
36
+ default: !1
37
+ },
38
+ // 是否禁用
39
+ disabled: {
40
+ type: Boolean,
41
+ default: !1
42
+ },
43
+ // 是否加载中状态
44
+ loading: {
45
+ type: Boolean,
46
+ default: !1
47
+ },
48
+ // 图标类名
49
+ icon: {
50
+ type: String,
51
+ default: ""
52
+ },
53
+ // 按钮文本
54
+ label: {
55
+ type: String,
56
+ default: ""
57
+ },
58
+ // 按钮宽度
59
+ width: {
60
+ type: [String, Number],
61
+ default: ""
62
+ },
63
+ // 按钮高度
64
+ height: {
65
+ type: [String, Number],
66
+ default: ""
67
+ },
68
+ // 是否块级按钮
69
+ block: {
70
+ type: Boolean,
71
+ default: !1
72
+ },
73
+ // 原生type属性
74
+ nativeType: {
75
+ type: String,
76
+ default: "button"
77
+ },
78
+ // 占位符(虽然按钮一般不需要,但为了演示代码提示)
79
+ placeholder: {
80
+ type: String,
81
+ default: ""
82
+ }
83
+ },
84
+ setup(e) {
85
+ const s = e, n = _(), o = i(null), l = h(null), a = d(() => ({ ...s, ...n }));
86
+ return y(async () => {
87
+ if (c) {
88
+ const t = await import("element-ui");
89
+ o.value = t.Button;
90
+ } else {
91
+ const t = await import("element-plus");
92
+ o.value = t.ElButton;
93
+ }
94
+ }), (t, f) => u(o) ? (b(), g(B(u(m)(u(o), { ...u(a), ref: u(l) }, t.$slots)), { key: 0 })) : I("", !0);
95
+ }
96
+ }), E = /* @__PURE__ */ S(M, [["__scopeId", "data-v-20d033dc"]]), P = $({
97
+ name: "MyButton",
98
+ // 关闭自动继承attrs,因为我们要手动绑定到component
99
+ inheritAttrs: !1,
100
+ // 定义基本的props,确保代码提示和类型检查
101
+ props: {
102
+ // 类型:primary/success/warning/danger/info/text
103
+ type: {
104
+ type: String,
105
+ default: "default"
106
+ },
107
+ // 尺寸:large/medium/small/mini
108
+ size: {
109
+ type: String,
110
+ default: "medium"
111
+ },
112
+ // 是否朴素按钮
113
+ plain: {
114
+ type: Boolean,
115
+ default: !1
116
+ },
117
+ // 是否圆角按钮
118
+ round: {
119
+ type: Boolean,
120
+ default: !1
121
+ },
122
+ // 是否圆形按钮
123
+ circle: {
124
+ type: Boolean,
125
+ default: !1
126
+ },
127
+ // 是否禁用
128
+ disabled: {
129
+ type: Boolean,
130
+ default: !1
131
+ },
132
+ // 是否加载中状态
133
+ loading: {
134
+ type: Boolean,
135
+ default: !1
136
+ },
137
+ // 图标类名
138
+ icon: {
139
+ type: String,
140
+ default: ""
141
+ },
142
+ // 按钮文本
143
+ label: {
144
+ type: String,
145
+ default: ""
146
+ },
147
+ // 按钮宽度
148
+ width: {
149
+ type: [String, Number],
150
+ default: ""
151
+ },
152
+ // 按钮高度
153
+ height: {
154
+ type: [String, Number],
155
+ default: ""
156
+ },
157
+ // 是否块级按钮
158
+ block: {
159
+ type: Boolean,
160
+ default: !1
161
+ },
162
+ // 原生type属性
163
+ nativeType: {
164
+ type: String,
165
+ default: "button"
166
+ },
167
+ // 占位符(虽然按钮一般不需要,但为了演示代码提示)
168
+ placeholder: {
169
+ type: String,
170
+ default: ""
171
+ }
172
+ },
173
+ setup(e, { attrs: s }) {
174
+ const n = i(null), o = d(() => ({ ...e, ...s })), l = v(), a = (t) => {
175
+ console.log(t, "elllll"), t && (l.exposed = t);
176
+ };
177
+ return y(async () => {
178
+ if (c) {
179
+ const t = await import("element-ui");
180
+ n.value = t.Button;
181
+ } else {
182
+ const t = await import("element-plus");
183
+ n.value = t.ElButton;
184
+ }
185
+ console.log(n.value, "buttonComponent.value"), console.log(l, "vmmmmm");
186
+ }), {
187
+ buttonComponent: n,
188
+ allProps: o,
189
+ h: m,
190
+ changeRef: a
191
+ };
192
+ }
193
+ });
194
+ function k(e, s, n, o, l, a) {
195
+ return b(), g(B(e.h(e.buttonComponent, { ...e.allProps, ref: e.changeRef }, e.$slots)));
196
+ }
197
+ const O = /* @__PURE__ */ S(P, [["render", k], ["__scopeId", "data-v-1cb31901"]]), N = {
198
+ name: "MyInput"
199
+ }, R = /* @__PURE__ */ Object.assign(N, {
200
+ props: {
201
+ // 类型:text/password/textarea/number/email/url/date
202
+ type: {
203
+ type: String,
204
+ default: "text"
205
+ },
206
+ // 尺寸:large/medium/small
207
+ size: {
208
+ type: String,
209
+ default: ""
210
+ },
211
+ // 占位符
212
+ placeholder: {
213
+ type: String,
214
+ default: ""
215
+ },
216
+ // 是否禁用
217
+ disabled: {
218
+ type: Boolean,
219
+ default: !1
220
+ },
221
+ // 是否只读
222
+ readonly: {
223
+ type: Boolean,
224
+ default: !1
225
+ },
226
+ // 是否可清空
227
+ clearable: {
228
+ type: Boolean,
229
+ default: !1
230
+ },
231
+ // 是否显示密码切换按钮
232
+ showPassword: {
233
+ type: Boolean,
234
+ default: !1
235
+ },
236
+ // 最大输入长度
237
+ maxlength: {
238
+ type: [String, Number],
239
+ default: null
240
+ },
241
+ // 是否显示字数统计
242
+ showWordLimit: {
243
+ type: Boolean,
244
+ default: !1
245
+ },
246
+ // 自动完成
247
+ autocomplete: {
248
+ type: String,
249
+ default: "off"
250
+ },
251
+ // 原生表单属性
252
+ name: {
253
+ type: String,
254
+ default: ""
255
+ },
256
+ // 原生表单属性
257
+ form: {
258
+ type: String,
259
+ default: ""
260
+ },
261
+ // 是否必填
262
+ required: {
263
+ type: Boolean,
264
+ default: !1
265
+ },
266
+ // 输入框宽度
267
+ width: {
268
+ type: [String, Number],
269
+ default: ""
270
+ }
271
+ },
272
+ emits: ["input", "change", "focus", "blur", "clear"],
273
+ setup(e, { expose: s, emit: n }) {
274
+ const o = e, l = _(), a = i(null), t = d(() => ({ ...o, ...l }));
275
+ y(async () => {
276
+ if (c) {
277
+ const r = await import("element-ui");
278
+ a.value = r.Input;
279
+ } else {
280
+ const r = await import("element-plus");
281
+ a.value = r.ElInput;
282
+ }
283
+ });
284
+ const f = v(), p = h(null), w = (r) => {
285
+ p.value = r, c && f && (f.exposed = r);
286
+ };
287
+ return s({
288
+ // 暴露底层输入框实例
289
+ getInputInstance: () => p.value,
290
+ // 常用的输入框方法
291
+ focus: () => p.value?.focus(),
292
+ blur: () => p.value?.blur(),
293
+ // 选择文本
294
+ select: () => p.value?.select(),
295
+ // 清空输入框
296
+ clear: () => p.value?.clear(),
297
+ // 直接暴露实例(在某些情况下可能更方便)
298
+ inputRef: p
299
+ }), (r, x) => u(a) ? (b(), g(B(u(m)(u(a), { ...u(t), ref: w }, r.$slots)), { key: 0 })) : I("", !0);
300
+ }
301
+ }), j = /* @__PURE__ */ S(R, [["__scopeId", "data-v-db6e0500"]]);
302
+ function U(e) {
303
+ e.component("SccbaButton", SccbaButton), e.component("MyButton1", MyButton1), e.component("SccbaInput", SccbaInput);
304
+ }
305
+ const T = { install: U };
306
+ export {
307
+ O as MyButton1,
308
+ T as MyUI,
309
+ E as SccbaButton,
310
+ j as SccbaInput,
311
+ U as install
312
+ };
@@ -0,0 +1 @@
1
+ (function(l,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue-demi"),require("vue")):typeof define=="function"&&define.amd?define(["exports","vue-demi","vue"],t):(l=typeof globalThis<"u"?globalThis:l||self,t(l.SccbaUI={},l.VueDemi,l.Vue))})(this,(function(l,t,e){"use strict";const d=(n,c)=>{const a=n.__vccOpts||n;for(const[s,u]of c)a[s]=u;return a},m=d(Object.assign({name:"MyButton",inheritAttrs:!1},{props:{type:{type:String,default:"default"},size:{type:String,default:""},plain:{type:Boolean,default:!1},round:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},icon:{type:String,default:""},label:{type:String,default:""},width:{type:[String,Number],default:""},height:{type:[String,Number],default:""},block:{type:Boolean,default:!1},nativeType:{type:String,default:"button"},placeholder:{type:String,default:""}},setup(n){const c=n,a=t.useAttrs(),s=t.shallowRef(null),u=t.ref(null),r=t.computed(()=>({...c,...a}));return t.onMounted(async()=>{if(t.isVue2){const o=await import("element-ui");s.value=o.Button}else{const o=await import("element-plus");s.value=o.ElButton}}),(o,i)=>e.unref(s)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t.h)(e.unref(s),{...e.unref(r),ref:e.unref(u)},o.$slots)),{key:0})):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-20d033dc"]]),g=t.defineComponent({name:"MyButton",inheritAttrs:!1,props:{type:{type:String,default:"default"},size:{type:String,default:"medium"},plain:{type:Boolean,default:!1},round:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},icon:{type:String,default:""},label:{type:String,default:""},width:{type:[String,Number],default:""},height:{type:[String,Number],default:""},block:{type:Boolean,default:!1},nativeType:{type:String,default:"button"},placeholder:{type:String,default:""}},setup(n,{attrs:c}){const a=t.shallowRef(null),s=t.computed(()=>({...n,...c})),u=t.getCurrentInstance(),r=o=>{console.log(o,"elllll"),o&&(u.exposed=o)};return t.onMounted(async()=>{if(t.isVue2){const o=await import("element-ui");a.value=o.Button}else{const o=await import("element-plus");a.value=o.ElButton}console.log(a.value,"buttonComponent.value"),console.log(u,"vmmmmm")}),{buttonComponent:a,allProps:s,h:t.h,changeRef:r}}});function _(n,c,a,s,u,r){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.h(n.buttonComponent,{...n.allProps,ref:n.changeRef},n.$slots)))}const b=d(g,[["render",_],["__scopeId","data-v-1cb31901"]]),B=d(Object.assign({name:"MyInput"},{props:{type:{type:String,default:"text"},size:{type:String,default:""},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},maxlength:{type:[String,Number],default:null},showWordLimit:{type:Boolean,default:!1},autocomplete:{type:String,default:"off"},name:{type:String,default:""},form:{type:String,default:""},required:{type:Boolean,default:!1},width:{type:[String,Number],default:""}},emits:["input","change","focus","blur","clear"],setup(n,{expose:c,emit:a}){const s=n,u=t.useAttrs(),r=t.shallowRef(null),o=t.computed(()=>({...s,...u}));t.onMounted(async()=>{if(t.isVue2){const f=await import("element-ui");r.value=f.Input}else{const f=await import("element-plus");r.value=f.ElInput}});const i=t.getCurrentInstance(),p=t.ref(null),h=f=>{p.value=f,t.isVue2&&i&&(i.exposed=f)};return c({getInputInstance:()=>p.value,focus:()=>p.value?.focus(),blur:()=>p.value?.blur(),select:()=>p.value?.select(),clear:()=>p.value?.clear(),inputRef:p}),(f,M)=>e.unref(r)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t.h)(e.unref(r),{...e.unref(o),ref:h},f.$slots)),{key:0})):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-db6e0500"]]);function y(n){n.component("SccbaButton",SccbaButton),n.component("MyButton1",MyButton1),n.component("SccbaInput",SccbaInput)}const S={install:y};l.MyButton1=b,l.MyUI=S,l.SccbaButton=m,l.SccbaInput=B,l.install=y,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "sccba-ui",
3
+ "version": "0.0.1",
4
+ "description": "一个基于 Vue 2/3 的 UI 组件库,使用 vue-demi 实现跨版本兼容",
5
+ "keywords": [
6
+ "vue",
7
+ "vue2",
8
+ "vue3",
9
+ "ui",
10
+ "components",
11
+ "element-ui",
12
+ "element-plus",
13
+ "vue-demi"
14
+ ],
15
+ "author": "",
16
+ "license": "MIT",
17
+ "type": "module",
18
+ "main": "dist/sccba-ui.cjs.js",
19
+ "module": "dist/sccba-ui.es.js",
20
+ "unpkg": "dist/sccba-ui.umd.js",
21
+ "exports": {
22
+ ".": {
23
+ "import": "./dist/sccba-ui.es.js",
24
+ "require": "./dist/sccba-ui.cjs.js"
25
+ }
26
+ },
27
+ "scripts": {
28
+ "dev": "vite",
29
+ "build": "vite build",
30
+ "preview": "vite preview",
31
+ "switch:vue2": "npx vue-demi-switch 2",
32
+ "switch:vue3": "npx vue-demi-switch 3"
33
+ },
34
+ "peerDependencies": {
35
+ "vue": "^2.7.0 || ^3.0.0"
36
+ },
37
+ "dependencies": {
38
+ "element-plus": "^2.13.0",
39
+ "element-ui": "^2.15.14",
40
+ "sass": "^1.97.1",
41
+ "vue-demi": "^0.14.10"
42
+ },
43
+ "devDependencies": {
44
+ "@vitejs/plugin-vue": "^6.0.1",
45
+ "@vue/composition-api": "^1.7.2",
46
+ "vite": "^7.2.4",
47
+ "vue": "^3.5.26",
48
+ "vue-template-compiler": "^2.7.16"
49
+ }
50
+ }