@ecolovo/uniapp-components 1.0.10 → 2.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/README.md +202 -66
- package/components/aspect/aspect.vue +24 -15
- package/components/badge/badge.scss +20 -0
- package/components/badge/badge.vue +49 -40
- package/components/button/button.scss +15 -0
- package/components/button/button.vue +121 -177
- package/components/checkbox/checkbox.scss +10 -0
- package/components/checkbox/checkbox.vue +118 -146
- package/components/checkbox-group/checkbox-group.vue +79 -85
- package/components/checkbox-group2/checkbox-group2.vue +111 -107
- package/components/checkbox-group2/checkbox2.vue +104 -0
- package/components/data-list/data-list.scss +9 -0
- package/components/data-list/data-list.vue +70 -79
- package/components/date-picker/date-picker-view.vue +125 -124
- package/components/date-picker/date-picker.vue +145 -146
- package/components/dialog/dialog-content.vue +39 -47
- package/components/dialog/dialog.scss +11 -0
- package/components/dialog/dialog.vue +125 -138
- package/components/dropdown/dropdown.scss +11 -0
- package/components/dropdown/dropdown.vue +55 -97
- package/components/empty/empty.scss +14 -0
- package/components/empty/empty.vue +42 -41
- package/components/flex/flex.vue +45 -54
- package/components/form/form.vue +29 -24
- package/components/form-item/form-item.scss +11 -0
- package/components/form-item/form-item.vue +43 -40
- package/components/icon/icon.vue +70 -85
- package/components/image/image.vue +35 -38
- package/components/input/input.vue +65 -79
- package/components/input/password-input.vue +34 -42
- package/components/list-page/list-page.vue +73 -99
- package/components/load-more/load-more.scss +12 -0
- package/components/load-more/load-more.vue +29 -29
- package/components/loading/animations/loading-animation1.vue +8 -8
- package/components/loading/animations/loading-animation2.vue +8 -9
- package/components/loading/animations/loading-animation3.vue +11 -11
- package/components/loading/animations/loading-animation4.vue +8 -8
- package/components/loading/loading.vue +19 -20
- package/components/message-box/message-box.vue +59 -41
- package/components/number-dialog/number-dialog.scss +9 -0
- package/components/number-dialog/number-dialog.vue +209 -204
- package/components/number-input/number-input.scss +9 -0
- package/components/number-input/number-input.vue +233 -232
- package/components/numpad/numpad.scss +9 -0
- package/components/numpad/numpad.vue +133 -150
- package/components/page/page-body.scss +15 -0
- package/components/page/page-body.vue +137 -119
- package/components/page/page-footer.scss +13 -0
- package/components/page/page-footer.vue +31 -33
- package/components/page/page-header.scss +17 -0
- package/components/page/page-header.vue +89 -94
- package/components/page/page.scss +9 -0
- package/components/page/page.vue +105 -81
- package/components/picker/picker-popup.vue +218 -209
- package/components/picker/picker.vue +99 -104
- package/components/popover/popover-content.vue +54 -63
- package/components/popover/popover-mask.vue +63 -63
- package/components/popover/popover.scss +28 -0
- package/components/popover/popover.vue +49 -47
- package/components/popup/popup-content.vue +49 -53
- package/components/popup/popup.scss +11 -0
- package/components/popup/popup.vue +117 -132
- package/components/price/price.scss +20 -0
- package/components/price/price.vue +31 -42
- package/components/search/search.scss +12 -0
- package/components/search/search.vue +93 -117
- package/components/searching/searching.vue +33 -40
- package/components/selector/selector.vue +43 -48
- package/components/switch/switch.scss +12 -0
- package/components/switch/switch.vue +99 -96
- package/components/tab/tab.scss +19 -0
- package/components/tab/tab.vue +151 -145
- package/components/textarea/textarea.vue +104 -101
- package/composable/component-name.d.ts +2 -0
- package/composable/component-name.js +8 -0
- package/composable/component-name.ts +10 -0
- package/configs/index.d.ts +25 -10
- package/configs/index.js +14 -23
- package/configs/index.ts +82 -0
- package/easyCom.d.ts +9 -0
- package/easyCom.js +1 -2
- package/easyCom.ts +31 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.ts +1 -0
- package/init.d.ts +4 -7
- package/init.js +5 -4
- package/init.ts +34 -0
- package/package.json +14 -4
- package/styles/utils/css-var.scss +12 -15
- package/styles/utils/ellipsis.scss +0 -7
- package/styles/utils/z-index.scss +1 -1
- package/styles/var/component.scss +21 -245
- package/utils/date.d.ts +47 -0
- package/utils/date.js +23 -43
- package/utils/date.ts +153 -0
- package/utils/freezeDeep.d.ts +1 -0
- package/utils/freezeDeep.js +4 -14
- package/utils/freezeDeep.ts +9 -0
- package/utils/price.d.ts +24 -0
- package/utils/price.js +14 -8
- package/utils/price.ts +57 -0
- package/utils/round.d.ts +2 -0
- package/utils/round.js +2 -14
- package/utils/round.ts +11 -0
- package/utils/windowInfo.d.ts +24 -0
- package/utils/windowInfo.js +8 -36
- package/utils/windowInfo.ts +50 -0
- package/components/checkbox-group2/checkbox.vue +0 -109
- package/components/datetime-picker/datetime-picker-view.vue +0 -209
- package/components/datetime-picker/datetime-picker.vue +0 -235
- package/components/form/mixin.js +0 -13
- package/components/list-page/list-page.js +0 -10
- package/components/table/table.vue +0 -112
- package/components/time-picker/time-picker-view.vue +0 -127
- package/components/time-picker/time-picker.vue +0 -140
- package/components/uploader/download.js +0 -81
- package/components/uploader/file-uploader.vue +0 -52
- package/components/uploader/files.js +0 -225
- package/components/uploader/media-uploader.vue +0 -189
- package/components/uploader/mixin.js +0 -171
- package/components/uploader/uni.js +0 -38
- package/components/uploader/upload-button.vue +0 -29
- package/components/uploader/uploader copy.vue +0 -547
- package/components/uploader/uploader.vue +0 -117
- package/mixins/componentName.js +0 -32
- package/mixins/listPage.js +0 -1
- package/mixins/windowInfo.js +0 -1
- package/utils/fileSize.js +0 -39
- package/utils/floor.js +0 -20
package/configs/index.js
CHANGED
|
@@ -1,42 +1,40 @@
|
|
|
1
|
+
import defaultIconfonts from '../resources/iconfont/uniapp_ui_icon/iconfont.json';
|
|
1
2
|
/** 组件前缀 */
|
|
2
3
|
let componentPrefix = 'app';
|
|
3
4
|
/** 首页路径 */
|
|
4
5
|
let homePath = '/pages/index/index';
|
|
5
|
-
|
|
6
6
|
/**
|
|
7
7
|
* 设置组件前缀
|
|
8
|
-
* @param
|
|
8
|
+
* @param prefix 组件前缀
|
|
9
9
|
*/
|
|
10
|
-
function setComponentPrefix(prefix) {
|
|
10
|
+
function setComponentPrefix(prefix = 'app') {
|
|
11
|
+
if (!prefix) throw new Error('组件前缀不能为空');
|
|
11
12
|
componentPrefix = prefix;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
14
|
/**
|
|
15
15
|
* 设置首页路径
|
|
16
|
-
* @param
|
|
16
|
+
* @param path 首页路径
|
|
17
17
|
*/
|
|
18
|
-
function setHomePath(path) {
|
|
18
|
+
function setHomePath(path = '/pages/index/index') {
|
|
19
|
+
if (!path) throw new Error('app 首页不能为空');
|
|
19
20
|
homePath = path;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
22
|
/** iconfont 图标 map */
|
|
23
23
|
const iconMap = new Map();
|
|
24
|
-
|
|
25
24
|
/**
|
|
26
25
|
* 添加单个图标
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
26
|
+
* @param fontFamily 字体文件名
|
|
27
|
+
* @param prefix 图标前缀
|
|
28
|
+
* @param name 图标名称
|
|
30
29
|
*/
|
|
31
30
|
function addIconToMap(fontFamily, prefix, name) {
|
|
32
31
|
if (iconMap.has(name)) {
|
|
33
32
|
// eslint-disable-next-line no-console
|
|
34
|
-
console.
|
|
33
|
+
console.warn(
|
|
35
34
|
`图标库 "${fontFamily}" 中的图标 "${name}" 在图标库 "${
|
|
36
35
|
iconMap.get(name).fontFamily
|
|
37
|
-
}"
|
|
36
|
+
}" 中已存在,新的图标将会覆盖已存在的同名图标`
|
|
38
37
|
);
|
|
39
|
-
return;
|
|
40
38
|
}
|
|
41
39
|
iconMap.set(name, {
|
|
42
40
|
fontFamily,
|
|
@@ -44,14 +42,9 @@ function addIconToMap(fontFamily, prefix, name) {
|
|
|
44
42
|
name,
|
|
45
43
|
});
|
|
46
44
|
}
|
|
47
|
-
|
|
48
45
|
/**
|
|
49
46
|
* 添加一组图标,传入 iconfont.json 文件内容
|
|
50
|
-
* @param
|
|
51
|
-
* @param {string} iconJson.font_family
|
|
52
|
-
* @param {string} iconJson.css_prefix_text
|
|
53
|
-
* @param {object[]} iconJson.glyphs
|
|
54
|
-
* @param {string} iconJson.glyphs.font_class
|
|
47
|
+
* @param iconJson iconfont.json 文件内容
|
|
55
48
|
*/
|
|
56
49
|
function addIcons(iconJson) {
|
|
57
50
|
const fontFamily = iconJson.font_family;
|
|
@@ -61,8 +54,6 @@ function addIcons(iconJson) {
|
|
|
61
54
|
addIconToMap(fontFamily, prefix, glyph.font_class);
|
|
62
55
|
});
|
|
63
56
|
}
|
|
64
|
-
|
|
65
57
|
// 添加内部图标库
|
|
66
|
-
addIcons(
|
|
67
|
-
|
|
58
|
+
addIcons(defaultIconfonts);
|
|
68
59
|
export { componentPrefix, homePath, setComponentPrefix, setHomePath, iconMap, addIcons };
|
package/configs/index.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import defaultIconfonts from '../resources/iconfont/uniapp_ui_icon/iconfont.json';
|
|
2
|
+
|
|
3
|
+
/** 组件前缀 */
|
|
4
|
+
let componentPrefix = 'app';
|
|
5
|
+
/** 首页路径 */
|
|
6
|
+
let homePath = '/pages/index/index';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 设置组件前缀
|
|
10
|
+
* @param prefix 组件前缀
|
|
11
|
+
*/
|
|
12
|
+
function setComponentPrefix(prefix: string = 'app') {
|
|
13
|
+
if (!prefix) throw new Error('组件前缀不能为空');
|
|
14
|
+
componentPrefix = prefix;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 设置首页路径
|
|
19
|
+
* @param path 首页路径
|
|
20
|
+
*/
|
|
21
|
+
function setHomePath(path: string = '/pages/index/index') {
|
|
22
|
+
if (!path) throw new Error('app 首页不能为空');
|
|
23
|
+
homePath = path;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface IconInfo {
|
|
27
|
+
/** 字体文件名 */
|
|
28
|
+
fontFamily: string;
|
|
29
|
+
/** 图标前缀 */
|
|
30
|
+
prefix: string;
|
|
31
|
+
/** 图标名称 */
|
|
32
|
+
name: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** iconfont 图标 map */
|
|
36
|
+
const iconMap: Map<string, IconInfo> = new Map();
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 添加单个图标
|
|
40
|
+
* @param fontFamily 字体文件名
|
|
41
|
+
* @param prefix 图标前缀
|
|
42
|
+
* @param name 图标名称
|
|
43
|
+
*/
|
|
44
|
+
function addIconToMap(fontFamily: string, prefix: string, name: string) {
|
|
45
|
+
if (iconMap.has(name)) {
|
|
46
|
+
// eslint-disable-next-line no-console
|
|
47
|
+
console.warn(
|
|
48
|
+
`图标库 "${fontFamily}" 中的图标 "${name}" 在图标库 "${
|
|
49
|
+
iconMap.get(name)!.fontFamily
|
|
50
|
+
}" 中已存在,新的图标将会覆盖已存在的同名图标`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
iconMap.set(name, {
|
|
54
|
+
fontFamily,
|
|
55
|
+
prefix,
|
|
56
|
+
name,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface IconFontJson {
|
|
61
|
+
font_family: string;
|
|
62
|
+
css_prefix_text: string;
|
|
63
|
+
glyphs: { font_class: string }[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 添加一组图标,传入 iconfont.json 文件内容
|
|
68
|
+
* @param iconJson iconfont.json 文件内容
|
|
69
|
+
*/
|
|
70
|
+
function addIcons(iconJson: IconFontJson) {
|
|
71
|
+
const fontFamily = iconJson.font_family;
|
|
72
|
+
const prefix = iconJson.css_prefix_text;
|
|
73
|
+
const glyphs = iconJson.glyphs;
|
|
74
|
+
glyphs.forEach((glyph) => {
|
|
75
|
+
addIconToMap(fontFamily, prefix, glyph.font_class);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 添加内部图标库
|
|
80
|
+
addIcons(defaultIconfonts);
|
|
81
|
+
|
|
82
|
+
export { componentPrefix, homePath, setComponentPrefix, setHomePath, iconMap, addIcons };
|
package/easyCom.d.ts
ADDED
package/easyCom.js
CHANGED
package/easyCom.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
function componentEasyCom(componentPrefix = 'app') {
|
|
2
|
+
return {
|
|
3
|
+
easycom: {
|
|
4
|
+
autoscan: true,
|
|
5
|
+
custom: {
|
|
6
|
+
[`^${componentPrefix}-date-picker-view`]:
|
|
7
|
+
'@ecolovo/uniapp-components/components/date-picker/date-picker-view.vue',
|
|
8
|
+
[`^${componentPrefix}-dialog-content`]:
|
|
9
|
+
'@ecolovo/uniapp-components/components/dialog/dialog-content.vue',
|
|
10
|
+
[`^${componentPrefix}-loading-animation(.*)`]:
|
|
11
|
+
'@ecolovo/uniapp-components/components/loading/animations/loading-animation$1.vue',
|
|
12
|
+
[`^${componentPrefix}-page-(.*)`]: '@ecolovo/uniapp-components/components/page/page-$1.vue',
|
|
13
|
+
[`^${componentPrefix}-password-input`]:
|
|
14
|
+
'@ecolovo/uniapp-components/components/input/password-input.vue',
|
|
15
|
+
[`^${componentPrefix}-picker-popup`]: '@ecolovo/uniapp-components/components/picker/picker-popup.vue',
|
|
16
|
+
[`^${componentPrefix}-popover-content`]:
|
|
17
|
+
'@ecolovo/uniapp-components/components/popover/popover-content.vue',
|
|
18
|
+
[`^${componentPrefix}-popover-mask`]: '@ecolovo/uniapp-components/components/popover/popover-mask.vue',
|
|
19
|
+
[`^${componentPrefix}-popup-content`]: '@ecolovo/uniapp-components/components/popup/popup-content.vue',
|
|
20
|
+
[`^${componentPrefix}-media-uploader`]:
|
|
21
|
+
'@ecolovo/uniapp-components/components/uploader/media-uploader.vue',
|
|
22
|
+
[`^${componentPrefix}-file-uploader`]:
|
|
23
|
+
'@ecolovo/uniapp-components/components/uploader/file-uploader.vue',
|
|
24
|
+
[`^${componentPrefix}-(.*)`]: '@ecolovo/uniapp-components/components/$1/$1.vue',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 导出 easycom 配置
|
|
31
|
+
export default componentEasyCom;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as init } from './init';
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as init } from './init';
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as init } from './init';
|
package/init.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IconFontJson } from './configs';
|
|
2
|
-
|
|
1
|
+
import type { IconFontJson } from './configs';
|
|
3
2
|
/** 组件库初始化配置 */
|
|
4
3
|
interface InitOptions {
|
|
5
4
|
/** 组件前缀 */
|
|
@@ -9,11 +8,9 @@ interface InitOptions {
|
|
|
9
8
|
/** iconfont 图标 json 文件 */
|
|
10
9
|
iconfont?: IconFontJson | IconFontJson[];
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param
|
|
12
|
+
* 组件库初始化方法,在使用组件库前调用
|
|
13
|
+
* @param options 组件库初始化配置
|
|
16
14
|
*/
|
|
17
|
-
declare
|
|
18
|
-
|
|
15
|
+
declare function init(options?: InitOptions): void;
|
|
19
16
|
export default init;
|
package/init.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { setComponentPrefix, setHomePath, addIcons } from './configs';
|
|
2
|
+
/**
|
|
3
|
+
* 组件库初始化方法,在使用组件库前调用
|
|
4
|
+
* @param options 组件库初始化配置
|
|
5
|
+
*/
|
|
4
6
|
function init(options = {}) {
|
|
5
7
|
if (options.componentPrefix) {
|
|
6
8
|
setComponentPrefix(options.componentPrefix);
|
|
@@ -16,5 +18,4 @@ function init(options = {}) {
|
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
|
-
|
|
20
21
|
export default init;
|
package/init.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { setComponentPrefix, setHomePath, addIcons } from './configs';
|
|
2
|
+
import type { IconFontJson } from './configs';
|
|
3
|
+
|
|
4
|
+
/** 组件库初始化配置 */
|
|
5
|
+
interface InitOptions {
|
|
6
|
+
/** 组件前缀 */
|
|
7
|
+
componentPrefix?: string;
|
|
8
|
+
/** 首页路径 */
|
|
9
|
+
homePath?: string;
|
|
10
|
+
/** iconfont 图标 json 文件 */
|
|
11
|
+
iconfont?: IconFontJson | IconFontJson[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 组件库初始化方法,在使用组件库前调用
|
|
16
|
+
* @param options 组件库初始化配置
|
|
17
|
+
*/
|
|
18
|
+
function init(options: InitOptions = {}) {
|
|
19
|
+
if (options.componentPrefix) {
|
|
20
|
+
setComponentPrefix(options.componentPrefix);
|
|
21
|
+
}
|
|
22
|
+
if (options.homePath) {
|
|
23
|
+
setHomePath(options.homePath);
|
|
24
|
+
}
|
|
25
|
+
if (options.iconfont) {
|
|
26
|
+
if (Array.isArray(options.iconfont)) {
|
|
27
|
+
options.iconfont.forEach(addIcons);
|
|
28
|
+
} else {
|
|
29
|
+
addIcons(options.iconfont);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default init;
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecolovo/uniapp-components",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Ecolovo UniApp 组件库",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Ecolovo UniApp Vue3 组件库",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"lint": "eslint
|
|
6
|
+
"lint": "eslint",
|
|
7
|
+
"lint:fix": "eslint --fix",
|
|
8
|
+
"build": "tsc"
|
|
7
9
|
},
|
|
8
10
|
"keywords": [
|
|
9
11
|
"uniapp",
|
|
@@ -12,18 +14,26 @@
|
|
|
12
14
|
"author": "Yang",
|
|
13
15
|
"license": "ISC",
|
|
14
16
|
"dependencies": {
|
|
17
|
+
"@ecolovo/utils": "^1.0.7",
|
|
15
18
|
"case-anything": "3.1.2",
|
|
16
|
-
"lodash-es": "4.17.21"
|
|
19
|
+
"lodash-es": "4.17.21",
|
|
20
|
+
"vue": "^3.4.21"
|
|
17
21
|
},
|
|
18
22
|
"devDependencies": {
|
|
19
23
|
"@dcloudio/types": "^3.4.30",
|
|
20
24
|
"@eslint/js": "^10.0.1",
|
|
25
|
+
"@types/lodash-es": "^4.17.12",
|
|
26
|
+
"@vue/eslint-config-prettier": "^10.2.0",
|
|
27
|
+
"@vue/eslint-config-typescript": "^14.8.0",
|
|
28
|
+
"@vue/tsconfig": "^0.1.3",
|
|
21
29
|
"eslint": "^10.0.3",
|
|
22
30
|
"eslint-config-prettier": "^10.1.8",
|
|
23
31
|
"eslint-plugin-prettier": "^5.5.5",
|
|
24
32
|
"eslint-plugin-vue": "^10.8.0",
|
|
25
33
|
"globals": "^17.4.0",
|
|
34
|
+
"miniprogram-api-typings": "^5.2.1",
|
|
26
35
|
"prettier": "^2.8.8",
|
|
36
|
+
"typescript": "^4.9.4",
|
|
27
37
|
"vue-eslint-parser": "^10.4.0"
|
|
28
38
|
}
|
|
29
39
|
}
|
|
@@ -4,11 +4,8 @@
|
|
|
4
4
|
@use 'sass:string';
|
|
5
5
|
@use '../var/theme' as *;
|
|
6
6
|
|
|
7
|
-
$component-name: null !default;
|
|
8
|
-
$component-vars: null !default;
|
|
9
|
-
|
|
10
7
|
// 返回组件外部变量名
|
|
11
|
-
@function UTILS__VAR_NAME($name, $component
|
|
8
|
+
@function UTILS__VAR_NAME($name, $component) {
|
|
12
9
|
@return string.unquote('--#{$component-prefix}-#{$component}--#{$name}');
|
|
13
10
|
}
|
|
14
11
|
|
|
@@ -25,7 +22,7 @@ $component-vars: null !default;
|
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
// 返回组件外部变量值
|
|
28
|
-
@function UTILS__VAR($name, $component
|
|
25
|
+
@function UTILS__VAR($name, $component, $default: null) {
|
|
29
26
|
@if $default != null {
|
|
30
27
|
@return var(UTILS__VAR_NAME($name, $component), $default);
|
|
31
28
|
}
|
|
@@ -43,17 +40,17 @@ $component-vars: null !default;
|
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
// 定义组件变量
|
|
46
|
-
@mixin UTILS__DEFINE_COMPONENT_VARS() {
|
|
47
|
-
@if not $
|
|
48
|
-
@error "
|
|
43
|
+
@mixin UTILS__DEFINE_COMPONENT_VARS($vars, $name) {
|
|
44
|
+
@if not $name {
|
|
45
|
+
@error "请传入 $name";
|
|
49
46
|
}
|
|
50
47
|
|
|
51
|
-
@if (not $
|
|
52
|
-
@error "
|
|
48
|
+
@if (not $vars) or (meta.type-of($vars) != 'map') {
|
|
49
|
+
@error "请传入 $vars";
|
|
53
50
|
}
|
|
54
51
|
|
|
55
|
-
@each $key, $value in $
|
|
56
|
-
@include __DO_NOT_USE__define-component-var($key, $value);
|
|
52
|
+
@each $key, $value in $vars {
|
|
53
|
+
@include __DO_NOT_USE__define-component-var($name, $key, $value);
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
56
|
|
|
@@ -65,12 +62,12 @@ $component-vars: null !default;
|
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
// 定义单个组件变量,不要直接调用
|
|
68
|
-
@mixin __DO_NOT_USE__define-component-var($name, $value) {
|
|
65
|
+
@mixin __DO_NOT_USE__define-component-var($component, $name, $value) {
|
|
69
66
|
@if not $component-prefix {
|
|
70
67
|
@error "请在调用 __DO_NOT_USE__define-component-var 之前设置 component-prefix";
|
|
71
68
|
}
|
|
72
69
|
|
|
73
|
-
$var-prefix: '#{$component-prefix}-#{$component
|
|
70
|
+
$var-prefix: '#{$component-prefix}-#{$component}';
|
|
74
71
|
|
|
75
72
|
$default: false;
|
|
76
73
|
|
|
@@ -78,7 +75,7 @@ $component-vars: null !default;
|
|
|
78
75
|
$default: true;
|
|
79
76
|
}
|
|
80
77
|
|
|
81
|
-
$var-name: UTILS__VAR_NAME($name);
|
|
78
|
+
$var-name: UTILS__VAR_NAME($name, $component);
|
|
82
79
|
$local-name: __DO_NOT_USE__local-var-name($name);
|
|
83
80
|
|
|
84
81
|
@if $default {
|