yanzhi-ui 0.1.0

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/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "yanzhi-ui",
3
+ "private": false,
4
+ "version": "0.1.0",
5
+ "main": "dist/yanzhi-ui.umd.cjs",
6
+ "module": "dist/yanzhi-ui.es.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": ["dist", "src/packages"],
9
+ "scripts": {
10
+ "dev": "vite",
11
+ "build": "vite build"
12
+ },
13
+ "peerDependencies": {
14
+ "vue": "^3.2.0"
15
+ },
16
+ "devDependencies": {
17
+ "vite": "^6.0.0",
18
+ "@vitejs/plugin-vue": "^5.2.0",
19
+ "vue": "^3.2.0",
20
+ "typescript": "^5.1.0"
21
+ }
22
+ }
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <button
3
+ :class="buttonClass"
4
+ :style="{ backgroundColor: color, color: textColor }"
5
+ :disabled="disabled || loading"
6
+ @click="$emit('click', $event)"
7
+ >
8
+ <slot />
9
+ </button>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import { computed } from 'vue'
14
+
15
+ interface ButtonProps {
16
+ type?: 'default' | 'primary' | 'success' | 'warning' | 'error'
17
+ size?: 'small' | 'medium' | 'large'
18
+ color?: string
19
+ textColor?: string
20
+ disabled?: boolean
21
+ loading?: boolean
22
+ }
23
+
24
+ const props = withDefaults(defineProps<ButtonProps>(), {
25
+ type: 'default',
26
+ size: 'medium',
27
+ disabled: false,
28
+ loading: false
29
+ })
30
+
31
+ const buttonClass = computed(() => {
32
+ const classes = ['i-button', props.type, props.size]
33
+ if (props.disabled) classes.push('disabled')
34
+ if (props.loading) classes.push('loading')
35
+ return classes.join(' ')
36
+ })
37
+
38
+ const color = computed(() => props.color || '')
39
+ const textColor = computed(() => props.textColor || '')
40
+ </script>
41
+
42
+ <style scoped>
43
+ .i-button {
44
+ border-radius: 4px;
45
+ padding: 0 12px;
46
+ height: 32px;
47
+ border: none;
48
+ cursor: pointer;
49
+ }
50
+ .i-button.small { height: 24px; }
51
+ .i-button.medium { height: 32px; }
52
+ .i-button.large { height: 40px; }
53
+ .i-button.disabled { cursor: not-allowed; opacity: 0.6; }
54
+ .i-button.loading { opacity: 0.8; }
55
+ </style>
@@ -0,0 +1 @@
1
+ export { default as IButton } from './button/Button.vue'