sard-uniapp 1.23.5 → 1.24.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/CHANGELOG.md +27 -0
- package/README.md +2 -2
- package/components/calendar-input/calendar-input.vue +1 -0
- package/components/card/README.md +7 -0
- package/components/card/card.vue +17 -8
- package/components/card/common.d.ts +1 -0
- package/components/card/index.scss +1 -1
- package/components/cascader-input/cascader-input.vue +1 -0
- package/components/checkbox-input/checkbox-input.vue +1 -0
- package/components/config/index.d.ts +20 -0
- package/components/config/index.js +18 -1
- package/components/cool-icon/README.md +81 -0
- package/components/cool-icon/common.d.ts +21 -0
- package/components/cool-icon/common.js +2 -0
- package/components/cool-icon/cool-icon.d.ts +16 -0
- package/components/cool-icon/cool-icon.vue +86 -0
- package/components/cool-icon/index.d.ts +1 -0
- package/components/cool-icon/index.js +1 -0
- package/components/cool-icon/index.scss +186 -0
- package/components/cool-icon/variables.scss +12 -0
- package/components/datetime-picker-input/datetime-picker-input.vue +1 -0
- package/components/datetime-range-picker-input/datetime-range-picker-input.vue +1 -0
- package/components/keyboard/README.md +15 -14
- package/components/keyboard/common.d.ts +3 -1
- package/components/keyboard/keyboard.d.ts +2 -1
- package/components/keyboard/keyboard.vue +9 -7
- package/components/radio-input/radio-input.vue +1 -0
- package/components/segmented/README.md +147 -0
- package/components/segmented/common.d.ts +52 -0
- package/components/segmented/common.js +8 -0
- package/components/segmented/index.d.ts +1 -0
- package/components/segmented/index.js +1 -0
- package/components/segmented/index.scss +60 -0
- package/components/segmented/segmented.d.ts +21 -0
- package/components/segmented/segmented.vue +163 -0
- package/components/segmented/variables.scss +21 -0
- package/components/segmented-item/common.d.ts +21 -0
- package/components/segmented-item/common.js +1 -0
- package/components/segmented-item/index.d.ts +1 -0
- package/components/segmented-item/index.js +1 -0
- package/components/segmented-item/index.scss +60 -0
- package/components/segmented-item/segmented-item.d.ts +14 -0
- package/components/segmented-item/segmented-item.vue +99 -0
- package/components/sticky/README.md +4 -0
- package/components/tree/README.md +5 -4
- package/components/tree/common.d.ts +5 -1
- package/components/tree/tree.d.ts +8 -0
- package/components/tree/tree.vue +11 -2
- package/components/tree-node/tree-node.vue +1 -1
- package/components/watermark/README.md +74 -0
- package/components/watermark/common.d.ts +37 -0
- package/components/watermark/common.js +10 -0
- package/components/watermark/index.d.ts +1 -0
- package/components/watermark/index.js +1 -0
- package/components/watermark/index.scss +28 -0
- package/components/watermark/variables.scss +5 -0
- package/components/watermark/watermark.d.ts +16 -0
- package/components/watermark/watermark.vue +263 -0
- package/global.d.ts +4 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/index.scss +3 -0
- package/package.json +3 -2
- package/utils/geometry.d.ts +11 -0
- package/utils/geometry.js +28 -0
- package/components/upload-preview/play.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
# [1.24.0](https://github.com/sutras/sard-uniapp/compare/v1.23.5...v1.24.0) (2025-08-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* *-input 类组件允许修改输入框箭头图标 ([2d2a719](https://github.com/sutras/sard-uniapp/commit/2d2a7199fcdf9cd9760a151edae8c28bb39c6f8a))
|
|
7
|
+
* **cascader-input:** 修复arrow属性失效; ([5b67a7a](https://github.com/sutras/sard-uniapp/commit/5b67a7a631abb04f86de28507d4195268338a0e1))
|
|
8
|
+
* **datetime-picker-input:** 修复arrow属性失效; ([f530c73](https://github.com/sutras/sard-uniapp/commit/f530c7384f78ed14e1af7f2fc5978fdcf26be17e))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* card 组件新增 collapsed 属性 ([9e6ec3b](https://github.com/sutras/sard-uniapp/commit/9e6ec3bd5e9b7a7e9834d7c1cdd69d0f0b8efaac))
|
|
14
|
+
* **keyboard:** 扩展键盘toggle方法支持传入mode参数 ([25c6767](https://github.com/sutras/sard-uniapp/commit/25c67671fc35dd349380c80e83eb1d26dc582ad5))
|
|
15
|
+
* **keyboard:** 添加键盘模式配置支持 ([e1dda90](https://github.com/sutras/sard-uniapp/commit/e1dda90788460c3c3b7af9f7c82d9c7a704fa910))
|
|
16
|
+
* tree 组件新增 check 事件 ([4985f46](https://github.com/sutras/sard-uniapp/commit/4985f4629029744cd6298b37d04a40235379fb89))
|
|
17
|
+
* 新增 cool-icon 组件 ([ba51ef1](https://github.com/sutras/sard-uniapp/commit/ba51ef12a312a7cde65d629170f8c9da2394cebb))
|
|
18
|
+
* 新增 segmented 组件 ([f70464a](https://github.com/sutras/sard-uniapp/commit/f70464aa3bbef71ed44be967995c210f64d1a536))
|
|
19
|
+
* 新增 watermark 组件 ([ce36afd](https://github.com/sutras/sard-uniapp/commit/ce36afd833dbc4eba4a06741faea3ba47dc704fd))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Performance Improvements
|
|
23
|
+
|
|
24
|
+
* 压缩图片 ([8cd341f](https://github.com/sutras/sard-uniapp/commit/8cd341f601449bb8ab8d2b0c65da1faedbe3373f))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
1
28
|
## [1.23.5](https://github.com/sutras/sard-uniapp/compare/v1.23.4...v1.23.5) (2025-08-12)
|
|
2
29
|
|
|
3
30
|
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
## 特性
|
|
27
27
|
|
|
28
|
-
- 🧩
|
|
28
|
+
- 🧩 101+个高质量组件,覆盖移动端主流场景
|
|
29
29
|
- 💪 支持一套代码同时开发 H5 / 小程序 / App
|
|
30
30
|
- 🌿 支持按需引入和 `Tree Shaking`
|
|
31
31
|
- 📖 详尽的文档和案例展示
|
|
@@ -137,7 +137,7 @@ npm run release
|
|
|
137
137
|
|
|
138
138
|
- 运行 `npm run nc` 命令创建组件
|
|
139
139
|
- 运行 `npm run nsc` 命令创建子组件
|
|
140
|
-
-
|
|
140
|
+
- 编写组件代码(接口、类型、结构、样式、交互)
|
|
141
141
|
- 编写案例代码
|
|
142
142
|
- 编写组件文档
|
|
143
143
|
- 编写测试用例
|
|
@@ -53,6 +53,12 @@ import Card from 'sard-uniapp/components/card/card.vue'
|
|
|
53
53
|
|
|
54
54
|
@code('${DEMO_PATH}/card/demo/Style.vue')
|
|
55
55
|
|
|
56
|
+
### 折叠 <sup>1.24+</sup>
|
|
57
|
+
|
|
58
|
+
可使用 `collapsed` 属性设置卡片折叠,折叠时将隐藏主体和底部,只显示头部。
|
|
59
|
+
|
|
60
|
+
@code('${DEMO_PATH}/card/demo/Collapsed.vue')
|
|
61
|
+
|
|
56
62
|
## API
|
|
57
63
|
|
|
58
64
|
### CardProps
|
|
@@ -67,6 +73,7 @@ import Card from 'sard-uniapp/components/card/card.vue'
|
|
|
67
73
|
| hover <sup>1.12.3+</sup> | 是否开启点击反馈 | boolean | false |
|
|
68
74
|
| hide-header-border <sup>1.20+</sup> | 是否隐藏头部边框 | boolean | false |
|
|
69
75
|
| hide-footer-border <sup>1.20+</sup> | 是否隐藏底部边框 | boolean | false |
|
|
76
|
+
| collapsed <sup>1.24+</sup> | 是否折叠 | boolean | false |
|
|
70
77
|
|
|
71
78
|
### CardSlots
|
|
72
79
|
|
package/components/card/card.vue
CHANGED
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
<slot name="extra">{{ extra }}</slot>
|
|
9
9
|
</view>
|
|
10
10
|
</view>
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<
|
|
16
|
-
|
|
11
|
+
<sar-collapse :visible="!collapsed">
|
|
12
|
+
<view :class="bem.e('body')">
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</view>
|
|
15
|
+
<view v-if="!footless" :class="bem.e('footer')">
|
|
16
|
+
<slot name="footer">{{ footer }}</slot>
|
|
17
|
+
</view>
|
|
18
|
+
</sar-collapse>
|
|
17
19
|
</view>
|
|
18
20
|
</template>
|
|
19
21
|
|
|
@@ -26,6 +28,7 @@ import {
|
|
|
26
28
|
createBem,
|
|
27
29
|
isVisibleEmpty
|
|
28
30
|
} from "../../utils";
|
|
31
|
+
import SarCollapse from "../collapse/collapse.vue";
|
|
29
32
|
/**
|
|
30
33
|
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
31
34
|
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
@@ -35,9 +38,13 @@ import {
|
|
|
35
38
|
* @property {boolean} hover 是否开启点击反馈,默认值:false。
|
|
36
39
|
* @property {boolean} hideHeaderBorder 是否隐藏头部边框,默认值:false。
|
|
37
40
|
* @property {boolean} hideFooterBorder 是否隐藏底部边框,默认值:false。
|
|
41
|
+
* @property {boolean} collapsed 是否折叠,默认值:false。
|
|
38
42
|
* @event {(event: any) => void} click 点击卡片时触发
|
|
39
43
|
*/
|
|
40
44
|
export default _defineComponent({
|
|
45
|
+
components: {
|
|
46
|
+
SarCollapse,
|
|
47
|
+
},
|
|
41
48
|
...{
|
|
42
49
|
options: {
|
|
43
50
|
virtualHost: true,
|
|
@@ -53,7 +60,8 @@ export default _defineComponent({
|
|
|
53
60
|
footer: { type: String, required: false },
|
|
54
61
|
hover: { type: Boolean, required: false },
|
|
55
62
|
hideHeaderBorder: { type: Boolean, required: false },
|
|
56
|
-
hideFooterBorder: { type: Boolean, required: false }
|
|
63
|
+
hideFooterBorder: { type: Boolean, required: false },
|
|
64
|
+
collapsed: { type: Boolean, required: false }
|
|
57
65
|
},
|
|
58
66
|
emits: ["click"],
|
|
59
67
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -79,13 +87,14 @@ export default _defineComponent({
|
|
|
79
87
|
bem.m("footless", footless.value),
|
|
80
88
|
bem.m("head-borderless", props.hideHeaderBorder),
|
|
81
89
|
bem.m("foot-borderless", props.hideFooterBorder),
|
|
90
|
+
bem.m("collapsed", props.collapsed),
|
|
82
91
|
props.rootClass
|
|
83
92
|
);
|
|
84
93
|
});
|
|
85
94
|
const cardStyle = computed(() => {
|
|
86
95
|
return stringifyStyle(props.rootStyle);
|
|
87
96
|
});
|
|
88
|
-
const __returned__ = { props, slots, emit, bem, headless, footless, onClick, cardClass, cardStyle };
|
|
97
|
+
const __returned__ = { props, slots, emit, bem, headless, footless, onClick, cardClass, cardStyle, SarCollapse };
|
|
89
98
|
return __returned__;
|
|
90
99
|
}
|
|
91
100
|
});
|
|
@@ -6,6 +6,7 @@ import { type CalendarProps } from '../calendar';
|
|
|
6
6
|
import { type CascaderInputProps } from '../cascader-input';
|
|
7
7
|
import { type CheckboxGroupProps } from '../checkbox';
|
|
8
8
|
import { type CheckboxInputProps } from '../checkbox-input';
|
|
9
|
+
import { type CoolIconProps } from '../cool-icon';
|
|
9
10
|
import { type DatetimePickerInputProps } from '../datetime-picker-input';
|
|
10
11
|
import { type DatetimeRangePickerInputProps } from '../datetime-range-picker-input';
|
|
11
12
|
import { type DialogProps } from '../dialog';
|
|
@@ -34,6 +35,7 @@ import { type RadioInputProps } from '../radio-input';
|
|
|
34
35
|
import { type RadioPopoutProps } from '../radio-popout';
|
|
35
36
|
import { type ResultProps } from '../result';
|
|
36
37
|
import { type SearchProps } from '../search';
|
|
38
|
+
import { type SegmentedProps } from '../segmented';
|
|
37
39
|
import { type SpaceProps } from '../space';
|
|
38
40
|
import { type StepperProps } from '../stepper';
|
|
39
41
|
import { type StepsProps } from '../steps';
|
|
@@ -43,6 +45,7 @@ import { type TagProps } from '../tag';
|
|
|
43
45
|
import { type ToastProps } from '../toast';
|
|
44
46
|
import { type TreeProps } from '../tree';
|
|
45
47
|
import { type UploadPreviewProps, type UploadProps } from '../upload';
|
|
48
|
+
import { type WatermarkProps } from '../watermark';
|
|
46
49
|
type DeepPartial<T> = {
|
|
47
50
|
[P in keyof T]?: T[P] extends Record<any, any> ? DeepPartial<T[P]> : T[P];
|
|
48
51
|
};
|
|
@@ -125,6 +128,9 @@ export declare const defaultConfig: {
|
|
|
125
128
|
checkboxPopout: {
|
|
126
129
|
validateEvent: boolean;
|
|
127
130
|
};
|
|
131
|
+
coolIcon: {
|
|
132
|
+
shape: CoolIconProps["shape"];
|
|
133
|
+
};
|
|
128
134
|
countDown: {
|
|
129
135
|
time: number;
|
|
130
136
|
autoStart: boolean;
|
|
@@ -248,6 +254,7 @@ export declare const defaultConfig: {
|
|
|
248
254
|
};
|
|
249
255
|
keyboard: {
|
|
250
256
|
type: KeyboardProps["type"];
|
|
257
|
+
mode: KeyboardProps["mode"];
|
|
251
258
|
};
|
|
252
259
|
listItem: {
|
|
253
260
|
arrowDirection: ListItemProps["arrowDirection"];
|
|
@@ -381,6 +388,12 @@ export declare const defaultConfig: {
|
|
|
381
388
|
shape: SearchProps["shape"];
|
|
382
389
|
focus: boolean;
|
|
383
390
|
};
|
|
391
|
+
segmented: {
|
|
392
|
+
size: SegmentedProps["size"];
|
|
393
|
+
shape: SegmentedProps["shape"];
|
|
394
|
+
direction: SegmentedProps["direction"];
|
|
395
|
+
validateEvent: boolean;
|
|
396
|
+
};
|
|
384
397
|
shareSheet: {
|
|
385
398
|
overlayClosable: boolean;
|
|
386
399
|
duration: number;
|
|
@@ -490,6 +503,13 @@ export declare const defaultConfig: {
|
|
|
490
503
|
columnGap: number;
|
|
491
504
|
rowGap: number;
|
|
492
505
|
};
|
|
506
|
+
watermark: {
|
|
507
|
+
width: number;
|
|
508
|
+
height: number;
|
|
509
|
+
rotate: number;
|
|
510
|
+
zIndex: number;
|
|
511
|
+
gap: () => NonNullable<WatermarkProps["gap"]>;
|
|
512
|
+
};
|
|
493
513
|
};
|
|
494
514
|
export type ConfigOptions = typeof defaultConfig;
|
|
495
515
|
export declare function setConfig(...optionsArgs: DeepPartial<ConfigOptions>[]): void;
|
|
@@ -79,6 +79,9 @@ export const defaultConfig = {
|
|
|
79
79
|
checkboxPopout: {
|
|
80
80
|
validateEvent: true,
|
|
81
81
|
},
|
|
82
|
+
coolIcon: {
|
|
83
|
+
shape: 'oval',
|
|
84
|
+
},
|
|
82
85
|
countDown: {
|
|
83
86
|
time: 0,
|
|
84
87
|
autoStart: true,
|
|
@@ -194,7 +197,7 @@ export const defaultConfig = {
|
|
|
194
197
|
modelValue: '',
|
|
195
198
|
validateEvent: true,
|
|
196
199
|
cursorSpacing: 30,
|
|
197
|
-
confirmType:
|
|
200
|
+
confirmType: undefined,
|
|
198
201
|
cursor: -1,
|
|
199
202
|
selectionStart: -1,
|
|
200
203
|
selectionEnd: -1,
|
|
@@ -202,6 +205,7 @@ export const defaultConfig = {
|
|
|
202
205
|
},
|
|
203
206
|
keyboard: {
|
|
204
207
|
type: 'number',
|
|
208
|
+
mode: 'chinese',
|
|
205
209
|
},
|
|
206
210
|
listItem: {
|
|
207
211
|
arrowDirection: 'right',
|
|
@@ -335,6 +339,12 @@ export const defaultConfig = {
|
|
|
335
339
|
shape: 'square',
|
|
336
340
|
focus: false,
|
|
337
341
|
},
|
|
342
|
+
segmented: {
|
|
343
|
+
size: 'middle',
|
|
344
|
+
shape: 'square',
|
|
345
|
+
direction: 'horizontal',
|
|
346
|
+
validateEvent: true,
|
|
347
|
+
},
|
|
338
348
|
shareSheet: {
|
|
339
349
|
overlayClosable: true,
|
|
340
350
|
duration: 250,
|
|
@@ -444,6 +454,13 @@ export const defaultConfig = {
|
|
|
444
454
|
columnGap: 16,
|
|
445
455
|
rowGap: 16,
|
|
446
456
|
},
|
|
457
|
+
watermark: {
|
|
458
|
+
width: 120,
|
|
459
|
+
height: 64,
|
|
460
|
+
rotate: -22,
|
|
461
|
+
zIndex: 9,
|
|
462
|
+
gap: () => [30, 30],
|
|
463
|
+
},
|
|
447
464
|
};
|
|
448
465
|
function extendProps(source, target) {
|
|
449
466
|
Object.keys(target).forEach((key) => {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 组件
|
|
3
|
+
title: CoolIcon
|
|
4
|
+
subtitle: 酷炫图标
|
|
5
|
+
group: 数据展示
|
|
6
|
+
version: 1.24+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 介绍
|
|
10
|
+
|
|
11
|
+
为一般的图标添加颜色、外框、背景和装饰物等元素,让其变得炫酷,可在缺少设计时也能展示不一般的效果。
|
|
12
|
+
|
|
13
|
+
## 引入
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import CoolIcon from 'sard-uniapp/components/cool-icon/cool-icon.vue'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 代码演示
|
|
20
|
+
|
|
21
|
+
### 椭圆
|
|
22
|
+
|
|
23
|
+
把图标放置在默认插槽,使用 `background` 属性设置外框背景色,使用 `color` 属性设置图标颜色,使用 `shape="oval"` 属性设置外框为椭圆形,就能得到一个精致漂亮的图标。
|
|
24
|
+
|
|
25
|
+
@code('${DEMO_PATH}/cool-icon/demo/Oval.vue')
|
|
26
|
+
|
|
27
|
+
### 圆形
|
|
28
|
+
|
|
29
|
+
使用 `shape="circle"` 属性设置外框为圆形。
|
|
30
|
+
|
|
31
|
+
@code('${DEMO_PATH}/cool-icon/demo/Circle.vue')
|
|
32
|
+
|
|
33
|
+
### 方形
|
|
34
|
+
|
|
35
|
+
使用 `shape="square"` 属性设置外框为方形。
|
|
36
|
+
|
|
37
|
+
@code('${DEMO_PATH}/cool-icon/demo/Square.vue')
|
|
38
|
+
|
|
39
|
+
### 三角形
|
|
40
|
+
|
|
41
|
+
使用 `shape="triangle"` 属性设置外框为三角形。
|
|
42
|
+
|
|
43
|
+
@code('${DEMO_PATH}/cool-icon/demo/Triangle.vue')
|
|
44
|
+
|
|
45
|
+
### 花朵
|
|
46
|
+
|
|
47
|
+
使用 `shape="flower"` 属性设置外框为花朵形状。
|
|
48
|
+
|
|
49
|
+
@code('${DEMO_PATH}/cool-icon/demo/Flower.vue')
|
|
50
|
+
|
|
51
|
+
### 尺寸
|
|
52
|
+
|
|
53
|
+
使用 `size` 属性设置外框尺寸,使用 `icon-size` 设置图标尺寸。
|
|
54
|
+
|
|
55
|
+
@code('${DEMO_PATH}/cool-icon/demo/Size.vue')
|
|
56
|
+
|
|
57
|
+
## API
|
|
58
|
+
|
|
59
|
+
### CoolIconProps
|
|
60
|
+
|
|
61
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
62
|
+
| ---------- | ------------------ | -------------------------------------------------------- | ------ |
|
|
63
|
+
| root-class | 组件根元素类名 | string | - |
|
|
64
|
+
| root-style | 组件根元素样式 | StyleValue | - |
|
|
65
|
+
| shape | 设置外框的形状 | 'circle' \| 'square' \| 'oval' \| 'triangle' \| 'flower' | 'oval' |
|
|
66
|
+
| color | 设置图标颜色 | string | - |
|
|
67
|
+
| background | 设置外框背景色颜色 | string | - |
|
|
68
|
+
| size | 设置外框尺寸 | string | - |
|
|
69
|
+
| icon-size | 设置图标尺寸 | string | - |
|
|
70
|
+
|
|
71
|
+
### CoolIconSlots
|
|
72
|
+
|
|
73
|
+
| 插槽 | 描述 | 属性 |
|
|
74
|
+
| ------- | -------------- | ---- |
|
|
75
|
+
| default | 自定义默认内容 | - |
|
|
76
|
+
|
|
77
|
+
## 主题定制
|
|
78
|
+
|
|
79
|
+
### CSS 变量
|
|
80
|
+
|
|
81
|
+
@code('./variables.scss#variables')
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type StyleValue } from 'vue';
|
|
2
|
+
export interface CoolIconProps {
|
|
3
|
+
rootStyle?: StyleValue;
|
|
4
|
+
rootClass?: string;
|
|
5
|
+
shape?: 'circle' | 'square' | 'oval' | 'triangle' | 'flower';
|
|
6
|
+
size?: string;
|
|
7
|
+
iconSize?: string;
|
|
8
|
+
color?: string;
|
|
9
|
+
background?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const defaultCoolIconProps: {
|
|
12
|
+
shape: CoolIconProps["shape"];
|
|
13
|
+
};
|
|
14
|
+
export interface CoolIconSlots {
|
|
15
|
+
default?(props: Record<string, never>): any;
|
|
16
|
+
}
|
|
17
|
+
export interface CoolIconEmits {
|
|
18
|
+
(e: 'click', event: any): void;
|
|
19
|
+
}
|
|
20
|
+
export interface CoolIconExpose {
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type CoolIconProps, type CoolIconSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<CoolIconSlots> & CoolIconSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<CoolIconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
|
+
click: (event: any) => any;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<CoolIconProps> & Readonly<{
|
|
6
|
+
onClick?: ((event: any) => any) | undefined;
|
|
7
|
+
}>, {
|
|
8
|
+
shape: "circle" | "square" | "oval" | "triangle" | "flower";
|
|
9
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="coolIconClass" :style="coolIconStyle" @click="onClick">
|
|
3
|
+
<view :class="bgClass" :style="bgStyle">
|
|
4
|
+
<view :class="bem.e('adorns')">
|
|
5
|
+
<view v-for="i in 6" :key="i" :class="bem.e('adorn')"></view>
|
|
6
|
+
</view>
|
|
7
|
+
</view>
|
|
8
|
+
<view :class="bem.e('icon')">
|
|
9
|
+
<slot></slot>
|
|
10
|
+
</view>
|
|
11
|
+
</view>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
16
|
+
import { computed } from "vue";
|
|
17
|
+
import { classNames, stringifyStyle, createBem } from "../../utils";
|
|
18
|
+
import {
|
|
19
|
+
defaultCoolIconProps
|
|
20
|
+
} from "./common";
|
|
21
|
+
/**
|
|
22
|
+
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
23
|
+
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
24
|
+
* @property {'circle' | 'square' | 'oval' | 'triangle' | 'flower'} shape 设置外框的形状,默认值:'oval'。
|
|
25
|
+
* @property {string} color 设置图标颜色,默认值:-。
|
|
26
|
+
* @property {string} background 设置外框背景色颜色,默认值:-。
|
|
27
|
+
* @property {string} size 设置外框尺寸,默认值:-。
|
|
28
|
+
* @property {string} iconSize 设置图标尺寸,默认值:-。
|
|
29
|
+
*/
|
|
30
|
+
export default _defineComponent({
|
|
31
|
+
...{
|
|
32
|
+
options: {
|
|
33
|
+
virtualHost: true,
|
|
34
|
+
styleIsolation: "shared"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
__name: "cool-icon",
|
|
38
|
+
props: _mergeDefaults({
|
|
39
|
+
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
40
|
+
rootClass: { type: String, required: false },
|
|
41
|
+
shape: { type: String, required: false },
|
|
42
|
+
size: { type: String, required: false },
|
|
43
|
+
iconSize: { type: String, required: false },
|
|
44
|
+
color: { type: String, required: false },
|
|
45
|
+
background: { type: String, required: false }
|
|
46
|
+
}, defaultCoolIconProps),
|
|
47
|
+
emits: ["click"],
|
|
48
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
49
|
+
const props = __props;
|
|
50
|
+
const emit = __emit;
|
|
51
|
+
const bem = createBem("cool-icon");
|
|
52
|
+
const onClick = (event) => {
|
|
53
|
+
emit("click", event);
|
|
54
|
+
};
|
|
55
|
+
__expose({});
|
|
56
|
+
const coolIconClass = computed(() => {
|
|
57
|
+
return classNames(bem.b(), bem.m(props.shape), props.rootClass);
|
|
58
|
+
});
|
|
59
|
+
const coolIconStyle = computed(() => {
|
|
60
|
+
return stringifyStyle(
|
|
61
|
+
{
|
|
62
|
+
width: props.size,
|
|
63
|
+
height: props.size,
|
|
64
|
+
fontSize: props.iconSize,
|
|
65
|
+
color: props.color
|
|
66
|
+
},
|
|
67
|
+
props.rootStyle
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
const bgClass = computed(() => {
|
|
71
|
+
return classNames(bem.e("bg"));
|
|
72
|
+
});
|
|
73
|
+
const bgStyle = computed(() => {
|
|
74
|
+
return stringifyStyle({
|
|
75
|
+
background: props.background
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
const __returned__ = { props, emit, bem, onClick, coolIconClass, coolIconStyle, bgClass, bgStyle };
|
|
79
|
+
return __returned__;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style lang="scss">
|
|
85
|
+
@import './index.scss';
|
|
86
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { CoolIconProps, CoolIconSlots, CoolIconEmits, CoolIconExpose, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|