@ecolovo/uniapp-components 1.0.5 → 1.0.8
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 +124 -0
- package/components/aspect/aspect.vue +3 -3
- package/components/badge/badge.vue +1 -1
- package/components/button/button.vue +2 -2
- package/components/checkbox/checkbox.vue +1 -1
- package/components/checkbox-group/checkbox-group.vue +1 -1
- package/components/checkbox-group2/checkbox-group2.vue +1 -1
- package/components/checkbox-group2/checkbox.vue +1 -1
- package/components/data-list/data-list.vue +1 -1
- package/components/date-picker/date-picker-view.vue +1 -1
- package/components/date-picker/date-picker.vue +1 -1
- package/components/datetime-picker/datetime-picker-view.vue +1 -1
- package/components/datetime-picker/datetime-picker.vue +1 -1
- package/components/dialog/dialog-content.vue +1 -1
- package/components/dialog/dialog.vue +1 -1
- package/components/dropdown/dropdown.vue +1 -1
- package/components/empty/empty.vue +1 -1
- package/components/flex/flex.vue +1 -1
- package/components/form/form.vue +1 -1
- package/components/form-item/form-item.vue +1 -1
- package/components/icon/icon.vue +1 -1
- package/components/image/image.vue +1 -1
- package/components/input/input.vue +1 -1
- package/components/input/password-input.vue +1 -1
- package/components/list-page/list-page.vue +1 -1
- package/components/load-more/load-more.vue +1 -1
- package/components/loading/animations/loading-animation1.vue +1 -1
- package/components/loading/animations/loading-animation2.vue +1 -1
- package/components/loading/animations/loading-animation3.vue +1 -1
- package/components/loading/animations/loading-animation4.vue +1 -1
- package/components/loading/loading.vue +1 -1
- package/components/message-box/message-box.vue +1 -1
- package/components/number-dialog/number-dialog.vue +1 -1
- package/components/number-input/number-input.vue +1 -1
- package/components/numpad/numpad.vue +1 -1
- package/components/page/page-body.vue +1 -1
- package/components/page/page-footer.vue +1 -1
- package/components/page/page-header.vue +1 -1
- package/components/page/page.vue +1 -1
- package/components/picker/picker-popup.vue +1 -1
- package/components/picker/picker.vue +1 -1
- package/components/popover/popover-content.vue +1 -1
- package/components/popover/popover-mask.vue +1 -1
- package/components/popover/popover.vue +1 -1
- package/components/popup/popup-content.vue +1 -1
- package/components/popup/popup.vue +1 -1
- package/components/price/price.vue +1 -1
- package/components/search/search.vue +1 -1
- package/components/searching/searching.vue +1 -1
- package/components/selector/selector.vue +1 -1
- package/components/switch/switch.vue +1 -1
- package/components/tab/tab.vue +1 -1
- package/components/table/table.vue +1 -1
- package/components/textarea/textarea.vue +1 -1
- package/components/time-picker/time-picker-view.vue +1 -1
- package/components/time-picker/time-picker.vue +1 -1
- package/components/uploader/file-uploader.vue +1 -1
- package/components/uploader/media-uploader.vue +7 -2
- package/components/uploader/upload-button.vue +1 -1
- package/components/uploader/uploader.vue +1 -1
- package/configs/index.js +1 -0
- package/mixins/componentName.js +2 -2
- package/package.json +14 -2
- package/styles/global.scss +4 -4
- package/styles/utils/z-index.scss +1 -1
- package/styles/var/theme.scss +20 -10
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# @ecolovo/uniapp-components
|
|
2
|
+
|
|
3
|
+
Ecolovo UniApp 组件库
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
使用 npm / yarn 安装
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @ecolovo/uniapp-components
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
同时需要使用 `uni-pages-hot-modules` 用来动态配置
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install uni-pages-hot-modules --save-dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### 1. 配置 `vue.config.js` 文件
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
// vue.config.js
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
// configs...
|
|
29
|
+
transpileDependencies: ['@ecolovo/uniapp-components'],
|
|
30
|
+
// other configs...
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2. 在 `src/main.js` 文件中初始化组件库
|
|
35
|
+
|
|
36
|
+
```javascript
|
|
37
|
+
// src/main.js
|
|
38
|
+
|
|
39
|
+
import init from '@ecolovo/uniapp-components/init';
|
|
40
|
+
|
|
41
|
+
init({
|
|
42
|
+
// 配置组件前缀
|
|
43
|
+
// 在使用时加上前缀,如 button 组件,使用 <ui-button>
|
|
44
|
+
componentPrefix: 'ui',
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 3. 配置 `src/pages.js` 文件,
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
// src/pages.js
|
|
52
|
+
|
|
53
|
+
const mergeWith = require('lodash/mergeWith');
|
|
54
|
+
const { hot } = require('uni-pages-hot-modules');
|
|
55
|
+
const componentEasyCom = require('@ecolovo/uniapp-components/easyCom');
|
|
56
|
+
|
|
57
|
+
module.exports = hot((pagesJson) => {
|
|
58
|
+
const pagesConfig = require('./pagesDef');
|
|
59
|
+
|
|
60
|
+
return mergeWith(
|
|
61
|
+
// pages.json 中的配置
|
|
62
|
+
pagesJson,
|
|
63
|
+
pagesConfig,
|
|
64
|
+
componentEasyCom('ui'), // 填入和步骤 2 中同样的前缀
|
|
65
|
+
function (objValue, srcValue) {
|
|
66
|
+
if (Array.isArray(objValue)) {
|
|
67
|
+
return objValue.concat(srcValue);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 4. 配置样式
|
|
75
|
+
|
|
76
|
+
#### 全局样式
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<!-- App.vue -->
|
|
80
|
+
|
|
81
|
+
<style lang="scss">
|
|
82
|
+
@use '@ecolovo/uniapp-components/styles/global';
|
|
83
|
+
</style>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### 自定义组件配置
|
|
87
|
+
|
|
88
|
+
```css
|
|
89
|
+
/* src/styles/prepend.scss */
|
|
90
|
+
|
|
91
|
+
@forward '@ecolovo/uniapp-components/styles/var/theme' with (
|
|
92
|
+
$themes: (
|
|
93
|
+
primary: #d92e20,
|
|
94
|
+
)
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
@forward '@ecolovo/uniapp-components/styles';
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
// vue.config.js
|
|
102
|
+
|
|
103
|
+
const sass = require('sass');
|
|
104
|
+
|
|
105
|
+
module.exports = {
|
|
106
|
+
// configs...
|
|
107
|
+
css: {
|
|
108
|
+
loaderOptions: {
|
|
109
|
+
scss: {
|
|
110
|
+
prependData: '@use "@/styles/prepend" as *;'
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
// other configs...
|
|
115
|
+
};
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Components
|
|
119
|
+
|
|
120
|
+
### Aspect
|
|
121
|
+
|
|
122
|
+
#### 属性
|
|
123
|
+
|
|
124
|
+
- ratio: `string | number` 纵横比,默认为 `1` ,即宽高相等
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view :class="componentClassNames">
|
|
3
|
-
<view :class="$style['Aspect--content-wrapper']" :style="{ paddingTop: 100
|
|
3
|
+
<view :class="$style['Aspect--content-wrapper']" :style="{ paddingTop: 100 * ratio + '%' }">
|
|
4
4
|
<view :class="$style['Aspect--content']" @click="$emit('click')">
|
|
5
5
|
<slot></slot>
|
|
6
6
|
</view>
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
import componentName from '../../mixins/componentName';
|
|
13
13
|
|
|
14
14
|
export default {
|
|
15
|
-
name: '
|
|
15
|
+
name: 'Aspect',
|
|
16
16
|
options: {
|
|
17
17
|
virtualHost: true,
|
|
18
18
|
styleIsolation: 'shared',
|
|
19
19
|
},
|
|
20
20
|
mixins: [componentName],
|
|
21
21
|
props: {
|
|
22
|
-
/**
|
|
22
|
+
/** 高与宽的比例,默认为 1,即宽高相等,2 表示高为宽的 2 倍 */
|
|
23
23
|
ratio: {
|
|
24
24
|
type: [String, Number],
|
|
25
25
|
default: 1,
|
|
@@ -64,7 +64,7 @@ import IconCpn from '../icon/icon.vue';
|
|
|
64
64
|
* 当 async 为 true 时,需要在父组件监听 click 事件的回调函数中调用传入的 resolve 或 reject 方法,否则按钮将持续处于 loading 状态
|
|
65
65
|
*/
|
|
66
66
|
export default {
|
|
67
|
-
name: '
|
|
67
|
+
name: 'Button',
|
|
68
68
|
components: { IconCpn },
|
|
69
69
|
mixins: [componentName],
|
|
70
70
|
options: {
|
|
@@ -240,7 +240,7 @@ $component-vars: $button;
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
%button-themes {
|
|
243
|
-
@each $name, $color in $
|
|
243
|
+
@each $name, $color in $themes {
|
|
244
244
|
--button-theme-#{$name}: #{$color};
|
|
245
245
|
}
|
|
246
246
|
}
|
|
@@ -51,7 +51,7 @@ import DatetimePickerViewCpn from './datetime-picker-view.vue';
|
|
|
51
51
|
const DATE_FORMAT = formatDate.DATE_MINUTE_WITH_YEAR;
|
|
52
52
|
|
|
53
53
|
export default {
|
|
54
|
-
name: '
|
|
54
|
+
name: 'DatetimePicker',
|
|
55
55
|
options: {
|
|
56
56
|
virtualHost: true,
|
|
57
57
|
styleIsolation: 'shared',
|
package/components/flex/flex.vue
CHANGED
package/components/form/form.vue
CHANGED
package/components/icon/icon.vue
CHANGED
package/components/page/page.vue
CHANGED
package/components/tab/tab.vue
CHANGED
|
@@ -27,7 +27,7 @@ import { formatDate } from '../../utils/date';
|
|
|
27
27
|
const hourOptions = range(0, 24).map((item) => ('' + item).padStart(2, '0'));
|
|
28
28
|
|
|
29
29
|
export default {
|
|
30
|
-
name: '
|
|
30
|
+
name: 'TimePickerView',
|
|
31
31
|
options: {
|
|
32
32
|
virtualHost: true,
|
|
33
33
|
styleIsolation: 'shared',
|
|
@@ -39,7 +39,12 @@
|
|
|
39
39
|
</view>
|
|
40
40
|
</aspect-cpn>
|
|
41
41
|
<!-- 上传按钮 -->
|
|
42
|
-
<aspect-cpn
|
|
42
|
+
<aspect-cpn
|
|
43
|
+
v-if="!isReadonly && restCount > 0"
|
|
44
|
+
:class="$style['Uploader--item']"
|
|
45
|
+
:style="styleWidth"
|
|
46
|
+
@click="selectFile"
|
|
47
|
+
>
|
|
43
48
|
<slot>
|
|
44
49
|
<button-cpn plain :class="$style['Uploader--button']">
|
|
45
50
|
<view style="line-height: 1.3em">
|
|
@@ -61,7 +66,7 @@ import LoadingCpn from '../loading/animations/loading-animation4.vue';
|
|
|
61
66
|
import UploadMixin from './mixin';
|
|
62
67
|
|
|
63
68
|
export default {
|
|
64
|
-
name: '
|
|
69
|
+
name: 'Uploader',
|
|
65
70
|
options: {
|
|
66
71
|
virtualHost: true,
|
|
67
72
|
styleIsolation: 'shared',
|
package/configs/index.js
CHANGED
|
@@ -12,6 +12,7 @@ const iconMap = new Map();
|
|
|
12
12
|
/** 添加单个图标 */
|
|
13
13
|
function addIconToMap(fontFamily, prefix, name) {
|
|
14
14
|
if (iconMap.has(name)) {
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
15
16
|
console.error(
|
|
16
17
|
`图标库 "${fontFamily}" 中的图标 "${name}" 在图标库 "${
|
|
17
18
|
iconMap.get(name).fontFamily
|
package/mixins/componentName.js
CHANGED
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
},
|
|
18
18
|
/** 添加前缀后的组件名-大驼峰模式 */
|
|
19
19
|
componentClass() {
|
|
20
|
-
return this.componentPrefix + this.$options.name
|
|
20
|
+
return this.componentPrefix + this.$options.name;
|
|
21
21
|
},
|
|
22
22
|
/** 添加前缀后的组件名-短横线模式 */
|
|
23
23
|
componentKebabClass() {
|
|
@@ -25,7 +25,7 @@ export default {
|
|
|
25
25
|
},
|
|
26
26
|
/** 合并后的组件类名 */
|
|
27
27
|
componentClassNames() {
|
|
28
|
-
const baseClass = this.$style?.[this.$options.name
|
|
28
|
+
const baseClass = this.$style?.[this.$options.name];
|
|
29
29
|
return [...(baseClass ? [baseClass] : []), this.componentClass, this.componentKebabClass];
|
|
30
30
|
},
|
|
31
31
|
},
|
package/package.json
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecolovo/uniapp-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Ecolovo UniApp 组件库",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"lint": "eslint . --fix"
|
|
7
|
+
},
|
|
5
8
|
"keywords": [
|
|
6
9
|
"uniapp",
|
|
7
10
|
"components"
|
|
8
11
|
],
|
|
9
12
|
"author": "Yang",
|
|
10
13
|
"license": "ISC",
|
|
11
|
-
"packageManager": "pnpm@10.10.0",
|
|
12
14
|
"dependencies": {
|
|
13
15
|
"case-anything": "3.1.2",
|
|
14
16
|
"lodash-es": "4.17.21"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@eslint/js": "^10.0.1",
|
|
20
|
+
"eslint": "^10.0.3",
|
|
21
|
+
"eslint-config-prettier": "^10.1.8",
|
|
22
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
23
|
+
"eslint-plugin-vue": "^10.8.0",
|
|
24
|
+
"globals": "^17.4.0",
|
|
25
|
+
"prettier": "^2.8.8",
|
|
26
|
+
"vue-eslint-parser": "^10.4.0"
|
|
15
27
|
}
|
|
16
28
|
}
|
package/styles/global.scss
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@use './utils' as *;
|
|
4
4
|
|
|
5
5
|
page {
|
|
6
|
-
@each $name, $value in $
|
|
6
|
+
@each $name, $value in $themes {
|
|
7
7
|
@for $i from 9 through 1 {
|
|
8
8
|
#{DO_NOT_USE__global-var-name(theme, $name + '-dark' + $i)}: #{color.scale($value, $blackness: $i * 10%)};
|
|
9
9
|
}
|
|
@@ -12,13 +12,13 @@ page {
|
|
|
12
12
|
#{DO_NOT_USE__global-var-name(theme, $name + '-light' + $i)}: #{color.scale($value, $whiteness: $i * 10%)};
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
@each $name, $value in $
|
|
15
|
+
@each $name, $value in $colors {
|
|
16
16
|
#{DO_NOT_USE__global-var-name(color, $name)}: #{$value};
|
|
17
17
|
}
|
|
18
|
-
@each $name, $value in $
|
|
18
|
+
@each $name, $value in $font-sizes {
|
|
19
19
|
#{DO_NOT_USE__global-var-name(font-size, $name)}: #{$value};
|
|
20
20
|
}
|
|
21
|
-
@each $name, $value in $
|
|
21
|
+
@each $name, $value in $others {
|
|
22
22
|
#{DO_NOT_USE__global-var-name(other, $name)}: #{$value};
|
|
23
23
|
}
|
|
24
24
|
}
|
package/styles/var/theme.scss
CHANGED
|
@@ -2,39 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
$component-prefix: 'app' !default;
|
|
4
4
|
|
|
5
|
-
$
|
|
5
|
+
$z-index-maps: () !default;
|
|
6
|
+
$z-index-maps-default: (
|
|
6
7
|
loading: 9999,
|
|
7
8
|
dialog: 4000,
|
|
8
9
|
dropdown: 3000,
|
|
9
10
|
popover: 3000,
|
|
10
11
|
page-header: 2000,
|
|
11
12
|
page-footer: 2000,
|
|
12
|
-
)
|
|
13
|
+
);
|
|
14
|
+
$z-index-maps: map.merge($z-index-maps-default, $z-index-maps);
|
|
13
15
|
|
|
14
|
-
$
|
|
16
|
+
$themes: () !default;
|
|
17
|
+
$themes-default: (
|
|
15
18
|
primary: #f26f24,
|
|
16
19
|
secondary: #1e87e9,
|
|
17
20
|
success: #6fe633,
|
|
18
21
|
warning: #f3bb2d,
|
|
19
22
|
danger: #ff0000,
|
|
20
23
|
info: #9a9a99,
|
|
21
|
-
)
|
|
24
|
+
);
|
|
25
|
+
$themes: map.merge($themes-default, $themes);
|
|
22
26
|
|
|
23
|
-
$
|
|
27
|
+
$colors: () !default;
|
|
28
|
+
$colors-default: (
|
|
24
29
|
foreground: #333,
|
|
25
30
|
background: #f4f5f6,
|
|
26
31
|
placeholder: #9a9a99,
|
|
27
32
|
disabled: c3c4c5,
|
|
28
|
-
)
|
|
33
|
+
);
|
|
34
|
+
$colors: map.merge($colors-default, $colors);
|
|
29
35
|
|
|
30
|
-
$
|
|
36
|
+
$font-sizes: () !default;
|
|
37
|
+
$font-sizes-default: (
|
|
31
38
|
small: 24rpx,
|
|
32
39
|
normal: 28rpx,
|
|
33
40
|
large: 32rpx,
|
|
34
|
-
)
|
|
41
|
+
);
|
|
42
|
+
$font-sizes: map.merge($font-sizes-default, $font-sizes);
|
|
35
43
|
|
|
36
|
-
$
|
|
44
|
+
$others: () !default;
|
|
45
|
+
$others-default: (
|
|
37
46
|
font-size-small: 24rpx,
|
|
38
47
|
font-size-normal: 28rpx,
|
|
39
48
|
font-size-large: 32rpx,
|
|
40
|
-
)
|
|
49
|
+
);
|
|
50
|
+
$others: map.merge($others-default, $others);
|