@ecolovo/uniapp-components 1.0.6 → 1.0.9
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 +117 -0
- package/components/aspect/aspect.vue +3 -3
- package/components/badge/badge.vue +1 -1
- package/components/button/button.vue +6 -2
- package/components/checkbox/checkbox.vue +18 -4
- 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 +11 -7
- package/components/dialog/dialog.vue +22 -14
- 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 +8 -3
- package/components/page/page-footer.vue +1 -1
- package/components/page/page-header.vue +24 -8
- package/components/page/page.vue +7 -7
- 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 +1 -1
- package/components/uploader/upload-button.vue +1 -1
- package/components/uploader/uploader.vue +1 -1
- package/configs/index.d.ts +22 -0
- package/configs/index.js +31 -4
- package/init.d.ts +19 -0
- package/init.js +4 -1
- package/mixins/componentName.js +2 -2
- package/package.json +15 -1
- package/styles/global.scss +4 -4
- package/styles/utils/css-var.scss +7 -2
- package/styles/utils/z-index.scss +1 -1
- package/styles/var/component.scss +5 -2
- package/styles/var/theme.scss +20 -10
- package/utils/windowInfo.js +0 -4
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
$component-prefix: 'ui', // 推荐修改为与组件前缀一致
|
|
93
|
+
$themes: (
|
|
94
|
+
primary: #d92e20,
|
|
95
|
+
)
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
@forward '@ecolovo/uniapp-components/styles';
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
// vue.config.js
|
|
103
|
+
|
|
104
|
+
const sass = require('sass');
|
|
105
|
+
|
|
106
|
+
module.exports = {
|
|
107
|
+
// configs...
|
|
108
|
+
css: {
|
|
109
|
+
loaderOptions: {
|
|
110
|
+
scss: {
|
|
111
|
+
prependData: '@use "@/styles/prepend" as *;'
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
// other configs...
|
|
116
|
+
};
|
|
117
|
+
```
|
|
@@ -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
|
}
|
|
@@ -346,6 +346,10 @@ $button-sizes: (
|
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
+
.Button--round {
|
|
350
|
+
border-radius: 100vh;
|
|
351
|
+
}
|
|
352
|
+
|
|
349
353
|
.Button--icon {
|
|
350
354
|
position: relative;
|
|
351
355
|
margin-right: 10rpx;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view :class="componentClassNames" @click="toggle()">
|
|
3
3
|
<icon-cpn
|
|
4
|
-
v-if="
|
|
4
|
+
v-if="hasIcon"
|
|
5
5
|
:icon="usingIcon || ''"
|
|
6
6
|
tap-size="50rpx"
|
|
7
7
|
:class="[$style['Checkbox--icon'], { [$style['Checkbox--checked']]: isChecked }]"
|
|
@@ -18,7 +18,7 @@ import { isFormReadonly } from '../form/mixin';
|
|
|
18
18
|
import IconCpn from '../icon/icon.vue';
|
|
19
19
|
|
|
20
20
|
export default {
|
|
21
|
-
name: '
|
|
21
|
+
name: 'Checkbox',
|
|
22
22
|
options: {
|
|
23
23
|
virtualHost: true,
|
|
24
24
|
styleIsolation: 'shared',
|
|
@@ -39,7 +39,7 @@ export default {
|
|
|
39
39
|
/** checkbox-group 组件的 props 对象,用于读取 radio 和图标 */
|
|
40
40
|
checkboxGroupProps: {
|
|
41
41
|
from: 'checkboxGroupProps',
|
|
42
|
-
default: {},
|
|
42
|
+
default: { icon: true, radio: false },
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
props: {
|
|
@@ -53,6 +53,16 @@ export default {
|
|
|
53
53
|
type: Boolean,
|
|
54
54
|
default: false,
|
|
55
55
|
},
|
|
56
|
+
/** 类型 */
|
|
57
|
+
radio: {
|
|
58
|
+
type: [Boolean, null],
|
|
59
|
+
default: null,
|
|
60
|
+
},
|
|
61
|
+
/** 是否显示勾选图标 */
|
|
62
|
+
icon: {
|
|
63
|
+
type: [Boolean, null],
|
|
64
|
+
default: null,
|
|
65
|
+
},
|
|
56
66
|
/** 选中时的图标 */
|
|
57
67
|
checkedIcon: {
|
|
58
68
|
type: String,
|
|
@@ -78,9 +88,13 @@ export default {
|
|
|
78
88
|
isInGroup() {
|
|
79
89
|
return !!this.checkboxGroupData;
|
|
80
90
|
},
|
|
91
|
+
/** 是否显示勾选图标 */
|
|
92
|
+
hasIcon() {
|
|
93
|
+
return this.icon === null ? this.checkboxGroupProps.icon : this.icon;
|
|
94
|
+
},
|
|
81
95
|
/** 是否为单选 */
|
|
82
96
|
isRadio() {
|
|
83
|
-
return
|
|
97
|
+
return this.radio === null ? this.checkboxGroupProps.radio : this.radio;
|
|
84
98
|
},
|
|
85
99
|
/** checkbox-group 的值 */
|
|
86
100
|
groupCheckedValue() {
|
|
@@ -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',
|
|
@@ -29,14 +29,18 @@
|
|
|
29
29
|
<slot v-if="$slots.footer" name="footer"></slot>
|
|
30
30
|
<view v-else-if="cancel || confirm" :class="$style['DialogContent--footer']">
|
|
31
31
|
<view v-if="cancel" :class="$style['DialogContent--button']">
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
<slot name="cancel">
|
|
33
|
+
<button-cpn plain @click="$emit('cancel')">
|
|
34
|
+
{{ cancel }}
|
|
35
|
+
</button-cpn>
|
|
36
|
+
</slot>
|
|
35
37
|
</view>
|
|
36
38
|
<view v-if="confirm" :class="$style['DialogContent--button']">
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
<slot name="confirm">
|
|
40
|
+
<button-cpn @click="$emit('confirm')">
|
|
41
|
+
{{ confirm }}
|
|
42
|
+
</button-cpn>
|
|
43
|
+
</slot>
|
|
40
44
|
</view>
|
|
41
45
|
</view>
|
|
42
46
|
</template>
|
|
@@ -51,7 +55,7 @@ import IconCpn from '../icon/icon.vue';
|
|
|
51
55
|
import PopoverContentCpn from '../popover/popover-content.vue';
|
|
52
56
|
|
|
53
57
|
export default {
|
|
54
|
-
name: '
|
|
58
|
+
name: 'DialogContent',
|
|
55
59
|
options: {
|
|
56
60
|
virtualHost: true,
|
|
57
61
|
styleIsolation: 'shared',
|
|
@@ -8,19 +8,21 @@
|
|
|
8
8
|
@close="$emit('close')"
|
|
9
9
|
@closed="$emit('closed')"
|
|
10
10
|
>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
<slot name="content">
|
|
12
|
+
<dialog-content-cpn
|
|
13
|
+
:loading="isLoading"
|
|
14
|
+
:title="title"
|
|
15
|
+
:center-title="centerTitle"
|
|
16
|
+
:show-close="showClose"
|
|
17
|
+
:cancel="cancel"
|
|
18
|
+
:confirm="confirm"
|
|
19
|
+
@close="onClose()"
|
|
20
|
+
@cancel="onCancel()"
|
|
21
|
+
@confirm="onConfirm()"
|
|
22
|
+
>
|
|
23
|
+
<slot></slot>
|
|
24
|
+
</dialog-content-cpn>
|
|
25
|
+
</slot>
|
|
24
26
|
</popover-mask-cpn>
|
|
25
27
|
</view>
|
|
26
28
|
</template>
|
|
@@ -31,7 +33,7 @@ import PopoverMaskCpn from '../popover/popover-mask.vue';
|
|
|
31
33
|
import DialogContentCpn from './dialog-content.vue';
|
|
32
34
|
|
|
33
35
|
export default {
|
|
34
|
-
name: '
|
|
36
|
+
name: 'Dialog',
|
|
35
37
|
options: {
|
|
36
38
|
virtualHost: true,
|
|
37
39
|
styleIsolation: 'shared',
|
|
@@ -116,6 +118,12 @@ export default {
|
|
|
116
118
|
|
|
117
119
|
this.close();
|
|
118
120
|
},
|
|
121
|
+
onCancel() {
|
|
122
|
+
this.onButton('cancel', this.closeOnCancel);
|
|
123
|
+
},
|
|
124
|
+
onConfirm() {
|
|
125
|
+
this.onButton('confirm', this.closeOnConfirm);
|
|
126
|
+
},
|
|
119
127
|
/** 点击取消或确认按钮
|
|
120
128
|
* @param {'cancel' | 'confirm'} btnType 按钮类型
|
|
121
129
|
* @param {boolean} shouldClose 是否自动关闭对话框
|
package/components/flex/flex.vue
CHANGED
package/components/form/form.vue
CHANGED
package/components/icon/icon.vue
CHANGED
|
@@ -54,7 +54,7 @@ import windowInfoMixin from '../../mixins/windowInfo';
|
|
|
54
54
|
const SCROLL_ANIMATION_DURATION = 300;
|
|
55
55
|
|
|
56
56
|
export default {
|
|
57
|
-
name: '
|
|
57
|
+
name: 'PageBody',
|
|
58
58
|
options: {
|
|
59
59
|
virtualHost: true,
|
|
60
60
|
styleIsolation: 'shared',
|
|
@@ -214,14 +214,19 @@ $component-vars: $page-body;
|
|
|
214
214
|
position: relative;
|
|
215
215
|
width: 100%;
|
|
216
216
|
min-height: 100%;
|
|
217
|
-
padding: UTILS__LOCAL_VAR(padding-
|
|
217
|
+
padding: UTILS__LOCAL_VAR(padding-top, UTILS__LOCAL_VAR(padding))
|
|
218
|
+
UTILS__LOCAL_VAR(padding-right, UTILS__LOCAL_VAR(padding))
|
|
219
|
+
UTILS__LOCAL_VAR(padding-bottom, UTILS__LOCAL_VAR(padding))
|
|
220
|
+
UTILS__LOCAL_VAR(padding-left, UTILS__LOCAL_VAR(padding));
|
|
218
221
|
box-sizing: border-box;
|
|
219
222
|
|
|
220
223
|
flex: 1;
|
|
221
224
|
display: flex;
|
|
222
225
|
flex-direction: column;
|
|
223
226
|
.PageBody--scroll-body & {
|
|
224
|
-
padding-bottom: calc(
|
|
227
|
+
padding-bottom: calc(
|
|
228
|
+
#{UTILS__LOCAL_VAR(padding-bottom, UTILS__LOCAL_VAR(padding))} + var(--bottom-safe-height)
|
|
229
|
+
);
|
|
225
230
|
}
|
|
226
231
|
}
|
|
227
232
|
</style>
|