@ecolovo/uniapp-components 1.0.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/components/aspect/aspect.vue +43 -0
- package/components/badge/badge.vue +88 -0
- package/components/button/button.vue +409 -0
- package/components/checkbox/checkbox.vue +183 -0
- package/components/checkbox-group/checkbox-group.vue +101 -0
- package/components/checkbox-group2/checkbox-group2.vue +138 -0
- package/components/checkbox-group2/checkbox.vue +103 -0
- package/components/data-list/data-list.vue +130 -0
- package/components/date-picker/date-picker-view.vue +181 -0
- package/components/date-picker/date-picker.vue +237 -0
- package/components/datetime-picker/datetime-picker-view.vue +209 -0
- package/components/datetime-picker/datetime-picker.vue +235 -0
- package/components/dialog/dialog-content.vue +162 -0
- package/components/dialog/dialog.vue +166 -0
- package/components/dropdown/dropdown.vue +145 -0
- package/components/empty/empty.vue +102 -0
- package/components/flex/flex.vue +76 -0
- package/components/form/form.vue +43 -0
- package/components/form/mixin.js +13 -0
- package/components/form-item/form-item.vue +141 -0
- package/components/icon/icon.vue +114 -0
- package/components/image/image.vue +61 -0
- package/components/input/input.vue +154 -0
- package/components/input/password-input.vue +95 -0
- package/components/list-page/list-page.js +10 -0
- package/components/list-page/list-page.vue +150 -0
- package/components/load-more/load-more.vue +97 -0
- package/components/loading/animations/loading-animation1.vue +92 -0
- package/components/loading/animations/loading-animation2.vue +28 -0
- package/components/loading/animations/loading-animation3.vue +81 -0
- package/components/loading/animations/loading-animation4.vue +74 -0
- package/components/loading/loading.vue +91 -0
- package/components/message-box/message-box.vue +60 -0
- package/components/number-dialog/number-dialog.vue +360 -0
- package/components/number-input/number-input.vue +352 -0
- package/components/numpad/numpad.vue +224 -0
- package/components/page/page-body.vue +227 -0
- package/components/page/page-footer.vue +75 -0
- package/components/page/page-header.vue +222 -0
- package/components/page/page.vue +128 -0
- package/components/picker/picker-popup.vue +295 -0
- package/components/picker/picker.vue +151 -0
- package/components/popover/popover-content.vue +255 -0
- package/components/popover/popover-mask.vue +113 -0
- package/components/popover/popover.vue +84 -0
- package/components/popup/popup-content.vue +162 -0
- package/components/popup/popup.vue +168 -0
- package/components/price/price.vue +104 -0
- package/components/search/search.vue +220 -0
- package/components/searching/searching.vue +86 -0
- package/components/selector/selector.vue +86 -0
- package/components/switch/switch.vue +180 -0
- package/components/tab/tab.vue +235 -0
- package/components/table/table.vue +112 -0
- package/components/textarea/textarea.vue +192 -0
- package/components/time-picker/time-picker-view.vue +127 -0
- package/components/time-picker/time-picker.vue +140 -0
- package/components/uploader/download.js +81 -0
- package/components/uploader/file-uploader.vue +52 -0
- package/components/uploader/files.js +225 -0
- package/components/uploader/media-uploader.vue +133 -0
- package/components/uploader/mixin.js +106 -0
- package/components/uploader/uni.js +38 -0
- package/components/uploader/upload-button.vue +29 -0
- package/components/uploader/uploader copy.vue +547 -0
- package/components/uploader/uploader.vue +117 -0
- package/configs/index.js +41 -0
- package/easyCom.js +25 -0
- package/init.js +17 -0
- package/mixins/componentName.js +32 -0
- package/mixins/listPage.js +1 -0
- package/mixins/windowInfo.js +1 -0
- package/package.json +12 -0
- package/resources/iconfont/uniapp_ui_icon/demo.css +539 -0
- package/resources/iconfont/uniapp_ui_icon/demo_index.html +555 -0
- package/resources/iconfont/uniapp_ui_icon/iconfont.css +78 -0
- package/resources/iconfont/uniapp_ui_icon/iconfont.js +1 -0
- package/resources/iconfont/uniapp_ui_icon/iconfont.json +121 -0
- package/resources/iconfont/uniapp_ui_icon/iconfont.woff2 +0 -0
- package/resources/image/empty.svg +13 -0
- package/styles/global.scss +24 -0
- package/styles/index.scss +2 -0
- package/styles/utils/css-var.scss +87 -0
- package/styles/utils/ellipsis.scss +26 -0
- package/styles/utils/global-var.scss +11 -0
- package/styles/utils/index.scss +5 -0
- package/styles/utils/selector.scss +5 -0
- package/styles/utils/z-index.scss +10 -0
- package/styles/var/component.scss +242 -0
- package/styles/var/index.scss +2 -0
- package/styles/var/theme.scss +40 -0
- package/utils/date.js +151 -0
- package/utils/floor.js +20 -0
- package/utils/freezeDeep.js +19 -0
- package/utils/price.js +32 -0
- package/utils/round.js +22 -0
- package/utils/windowInfo.js +77 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="[
|
|
4
|
+
componentClassNames,
|
|
5
|
+
{
|
|
6
|
+
[$style['FormItem--line']]: usingType === 'line',
|
|
7
|
+
[$style['FormItem--next']]: usingType === 'next',
|
|
8
|
+
[$style['FormItem--block']]: usingType === 'block',
|
|
9
|
+
},
|
|
10
|
+
]"
|
|
11
|
+
>
|
|
12
|
+
<view :class="$style['FormItem--label']">
|
|
13
|
+
<text :class="{ [$style['FormItem--required']]: !isFormReadonly && required }">{{ label }}</text>
|
|
14
|
+
<text v-if="subLabel" :class="$style['FormItem--sub-label']">{{ subLabel }}</text>
|
|
15
|
+
</view>
|
|
16
|
+
<view :class="$style['FormItem--content']">
|
|
17
|
+
<slot></slot>
|
|
18
|
+
</view>
|
|
19
|
+
</view>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import componentName from '../../mixins/componentName';
|
|
24
|
+
import { isFormReadonly } from '../form/mixin';
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
name: 'AppFormItem',
|
|
28
|
+
options: {
|
|
29
|
+
virtualHost: true,
|
|
30
|
+
styleIsolation: 'shared',
|
|
31
|
+
},
|
|
32
|
+
mixins: [componentName, isFormReadonly],
|
|
33
|
+
props: {
|
|
34
|
+
/** 标签文本 */
|
|
35
|
+
label: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: '',
|
|
38
|
+
},
|
|
39
|
+
/** 副标签文本 */
|
|
40
|
+
subLabel: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: '',
|
|
43
|
+
},
|
|
44
|
+
/** 是否必填 */
|
|
45
|
+
required: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false,
|
|
48
|
+
},
|
|
49
|
+
/** 显示类型 */
|
|
50
|
+
type: {
|
|
51
|
+
type: String,
|
|
52
|
+
validator: (val) => !val || ['line', 'next', 'block'].includes(val),
|
|
53
|
+
default: '',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
computed: {
|
|
57
|
+
usingType() {
|
|
58
|
+
return this.type || this.formProps.type || 'line';
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style lang="scss" module>
|
|
65
|
+
@use '../../styles/index' as *;
|
|
66
|
+
|
|
67
|
+
// 定义外部变量
|
|
68
|
+
$component-name: 'form-item';
|
|
69
|
+
$component-vars: $form-item;
|
|
70
|
+
%external-vars {
|
|
71
|
+
@include UTILS__DEFINE_COMPONENT_VARS();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.FormItem {
|
|
75
|
+
@extend %external-vars;
|
|
76
|
+
position: relative;
|
|
77
|
+
|
|
78
|
+
.FormItem--required::after {
|
|
79
|
+
position: absolute;
|
|
80
|
+
content: '*';
|
|
81
|
+
color: #f00;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.FormItem--label {
|
|
85
|
+
color: #999;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&.FormItem--line {
|
|
89
|
+
display: flex;
|
|
90
|
+
|
|
91
|
+
.FormItem--label {
|
|
92
|
+
flex: none;
|
|
93
|
+
width: UTILS__LOCAL_VAR(label-width);
|
|
94
|
+
margin-right: 30rpx;
|
|
95
|
+
height: UTILS__LOCAL_VAR(height);
|
|
96
|
+
line-height: UTILS__LOCAL_VAR(height);
|
|
97
|
+
}
|
|
98
|
+
.FormItem--sub-label {
|
|
99
|
+
display: none;
|
|
100
|
+
}
|
|
101
|
+
.FormItem--content {
|
|
102
|
+
flex: 1;
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&.FormItem--next {
|
|
109
|
+
.FormItem--label {
|
|
110
|
+
margin-top: 20rpx;
|
|
111
|
+
margin-bottom: 12rpx;
|
|
112
|
+
}
|
|
113
|
+
.FormItem--sub-label {
|
|
114
|
+
margin-left: 30rpx;
|
|
115
|
+
font-size: UTILS__GLOBAL_VAR(font-size, small);
|
|
116
|
+
font-weight: 400;
|
|
117
|
+
color: #999;
|
|
118
|
+
}
|
|
119
|
+
.FormItem--content {
|
|
120
|
+
min-height: UTILS__LOCAL_VAR(height);
|
|
121
|
+
display: flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&.FormItem--block {
|
|
127
|
+
@extend .FormItem--next;
|
|
128
|
+
|
|
129
|
+
.FormItem--label {
|
|
130
|
+
font-size: UTILS__GLOBAL_VAR(font-size, large);
|
|
131
|
+
font-weight: 600;
|
|
132
|
+
}
|
|
133
|
+
.FormItem--content {
|
|
134
|
+
padding: 0 20rpx;
|
|
135
|
+
background: UTILS__GLOBAL_VAR(color, background);
|
|
136
|
+
border-radius: 12rpx;
|
|
137
|
+
height: 104rpx;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
</style>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<text
|
|
3
|
+
:class="[componentClassNames, iconClass, loadingAnimation, { [$style['Icon--expand-tap-size']]: tapSize }]"
|
|
4
|
+
:style="styleStr"
|
|
5
|
+
@click="$emit('click')"
|
|
6
|
+
>
|
|
7
|
+
</text>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import componentName from '../../mixins/componentName';
|
|
12
|
+
import { iconMap } from '../../configs';
|
|
13
|
+
|
|
14
|
+
const iconListStr = iconMap.keys().toArray().sort().join('\n');
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: 'AppIcon',
|
|
18
|
+
options: {
|
|
19
|
+
virtualHost: true,
|
|
20
|
+
styleIsolation: 'shared',
|
|
21
|
+
},
|
|
22
|
+
mixins: [componentName],
|
|
23
|
+
props: {
|
|
24
|
+
/** 图标名 */
|
|
25
|
+
icon: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: '',
|
|
28
|
+
},
|
|
29
|
+
/** 点击范围 */
|
|
30
|
+
tapSize: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: '',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
iconClass() {
|
|
37
|
+
const iconInfo = iconMap.get(this.icon);
|
|
38
|
+
if (!iconInfo) {
|
|
39
|
+
/* eslint-disable no-console */
|
|
40
|
+
console.error(`${this.componentClass} Error: 找不到图标 "${this.icon}"`);
|
|
41
|
+
if (process.env.NODE_ENV === 'development') {
|
|
42
|
+
console.groupCollapsed(`%c查看解决方法`, 'color: orange');
|
|
43
|
+
console.warn(
|
|
44
|
+
[
|
|
45
|
+
'请检查是否在 `main.js` 文件中调用了组件库的 `init` 方法,并传入了图标文件的 json 文件',
|
|
46
|
+
'例:',
|
|
47
|
+
'```',
|
|
48
|
+
'// main.js',
|
|
49
|
+
"import init from '@ecolovo/ec-ui/init';",
|
|
50
|
+
"init({ iconfont: require('@/resources/iconfont/some_icon/iconfont.json') });",
|
|
51
|
+
'\n// App.vue -> <style>',
|
|
52
|
+
"@import '@/resources/iconfont/iconfont.css';",
|
|
53
|
+
'```',
|
|
54
|
+
`\n当前可用图标: `,
|
|
55
|
+
iconListStr,
|
|
56
|
+
].join('\n')
|
|
57
|
+
);
|
|
58
|
+
console.groupEnd();
|
|
59
|
+
}
|
|
60
|
+
/* eslint-enable no-console */
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
return [iconInfo.fontFamily, iconInfo.prefix + iconInfo.name];
|
|
64
|
+
},
|
|
65
|
+
loadingAnimation() {
|
|
66
|
+
return /(?<![a-zA-Z])loading(?![a-zA-Z])/.test(this.icon) ? this.$style['Icon--spinner'] : '';
|
|
67
|
+
},
|
|
68
|
+
styleStr() {
|
|
69
|
+
return `--tap-size: ${this.tapSize || '100%'};`;
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<style lang="scss">
|
|
76
|
+
@import '../../resources/iconfont/uniapp_ui_icon/iconfont.css';
|
|
77
|
+
|
|
78
|
+
.uniapp_ui_icon {
|
|
79
|
+
font-size: inherit;
|
|
80
|
+
line-height: inherit;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
83
|
+
|
|
84
|
+
<style lang="scss" module>
|
|
85
|
+
.Icon {
|
|
86
|
+
display: inline-block;
|
|
87
|
+
font-size: inherit;
|
|
88
|
+
color: inherit;
|
|
89
|
+
}
|
|
90
|
+
.Icon--expand-tap-size {
|
|
91
|
+
position: relative;
|
|
92
|
+
&::after {
|
|
93
|
+
content: '';
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 50%;
|
|
96
|
+
left: 50%;
|
|
97
|
+
width: var(--tap-size, 100%);
|
|
98
|
+
height: var(--tap-size, 100%);
|
|
99
|
+
transform: translate(-50%, -50%);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
.Icon--spinner {
|
|
103
|
+
animation: circle var(--animation-duration, 0.75s) linear infinite;
|
|
104
|
+
|
|
105
|
+
@keyframes circle {
|
|
106
|
+
0% {
|
|
107
|
+
rotate: 0deg;
|
|
108
|
+
}
|
|
109
|
+
100% {
|
|
110
|
+
rotate: 360deg;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<image
|
|
3
|
+
:src="src || ''"
|
|
4
|
+
:preview-list="previewList"
|
|
5
|
+
:class="componentClassNames"
|
|
6
|
+
:mode="mode"
|
|
7
|
+
@click="preview"
|
|
8
|
+
></image>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import componentName from '../../mixins/componentName';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
name: 'AppImage',
|
|
16
|
+
options: {
|
|
17
|
+
virtualHost: true,
|
|
18
|
+
styleIsolation: 'shared',
|
|
19
|
+
},
|
|
20
|
+
mixins: [componentName],
|
|
21
|
+
props: {
|
|
22
|
+
/** 图片地址 */
|
|
23
|
+
src: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: '',
|
|
26
|
+
},
|
|
27
|
+
/** 图片显示模式 */
|
|
28
|
+
mode: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: '',
|
|
31
|
+
},
|
|
32
|
+
/** 预览列表 */
|
|
33
|
+
previewList: {
|
|
34
|
+
type: Array,
|
|
35
|
+
default: () => [],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
preview() {
|
|
40
|
+
if (this.previewList.length > 0) {
|
|
41
|
+
uni.previewImage({
|
|
42
|
+
current: this.src,
|
|
43
|
+
urls: this.previewList,
|
|
44
|
+
});
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
uni.previewImage({
|
|
48
|
+
current: this.src,
|
|
49
|
+
urls: [this.src],
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<style lang="scss" module>
|
|
57
|
+
.Image {
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="componentClassNames" @click="setFocus">
|
|
3
|
+
<view
|
|
4
|
+
v-if="isReadonly || (useText && value && !focused)"
|
|
5
|
+
:class="[$style['Input--text'], { [$style['Input--ellipsis']]: ellipsis }]"
|
|
6
|
+
>
|
|
7
|
+
{{ value }}
|
|
8
|
+
</view>
|
|
9
|
+
<input
|
|
10
|
+
v-else
|
|
11
|
+
:value="value"
|
|
12
|
+
:type="type"
|
|
13
|
+
:disabled="disabled"
|
|
14
|
+
:maxlength="maxlength"
|
|
15
|
+
:placeholder="placeholder"
|
|
16
|
+
:focus="focused"
|
|
17
|
+
always-embed
|
|
18
|
+
:class="$style['Input--input']"
|
|
19
|
+
:placeholder-class="$style['Input--input-placeholder']"
|
|
20
|
+
@input="$emit('input', $event.detail.value)"
|
|
21
|
+
@confirm="focused = false"
|
|
22
|
+
@blur="focused = false"
|
|
23
|
+
/>
|
|
24
|
+
<icon-cpn
|
|
25
|
+
v-if="!isReadonly && clearable && value"
|
|
26
|
+
icon="close-circle-filled"
|
|
27
|
+
:class="$style['Input--icon']"
|
|
28
|
+
tap-size="80rpx"
|
|
29
|
+
@click="$emit('input', '')"
|
|
30
|
+
>
|
|
31
|
+
</icon-cpn>
|
|
32
|
+
</view>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import componentName from '../../mixins/componentName';
|
|
37
|
+
import { isFormReadonly } from '../form/mixin';
|
|
38
|
+
import IconCpn from '../icon/icon.vue';
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
name: 'AppInput',
|
|
42
|
+
options: {
|
|
43
|
+
virtualHost: true,
|
|
44
|
+
styleIsolation: 'shared',
|
|
45
|
+
},
|
|
46
|
+
components: { IconCpn },
|
|
47
|
+
mixins: [componentName, isFormReadonly],
|
|
48
|
+
props: {
|
|
49
|
+
/** 绑定值 */
|
|
50
|
+
value: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: '',
|
|
53
|
+
},
|
|
54
|
+
/** 键盘类型 */
|
|
55
|
+
type: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: 'text',
|
|
58
|
+
},
|
|
59
|
+
/** 是否添加清空图标 */
|
|
60
|
+
clearable: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: false,
|
|
63
|
+
},
|
|
64
|
+
/** 是否禁用 */
|
|
65
|
+
disabled: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: false,
|
|
68
|
+
},
|
|
69
|
+
/** 是否只读 */
|
|
70
|
+
readonly: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false,
|
|
73
|
+
},
|
|
74
|
+
/** 文本超长时是否省略 */
|
|
75
|
+
ellipsis: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false,
|
|
78
|
+
},
|
|
79
|
+
/** 最大输入长度 */
|
|
80
|
+
maxlength: {
|
|
81
|
+
type: Number,
|
|
82
|
+
default: 140,
|
|
83
|
+
},
|
|
84
|
+
/** 占位文本 */
|
|
85
|
+
placeholder: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: '请输入',
|
|
88
|
+
},
|
|
89
|
+
/** 当不聚焦时是否使用文本替换 input */
|
|
90
|
+
useText: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: false,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
data() {
|
|
96
|
+
return {
|
|
97
|
+
/** 是否聚焦 */
|
|
98
|
+
focused: false,
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
computed: {
|
|
102
|
+
isReadonly() {
|
|
103
|
+
return this.readonly || this.isFormReadonly;
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
methods: {
|
|
107
|
+
/** 设置焦点 */
|
|
108
|
+
setFocus() {
|
|
109
|
+
if (this.disabled || this.isReadonly) return;
|
|
110
|
+
|
|
111
|
+
this.focused = true;
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<style lang="scss" module>
|
|
118
|
+
@use '../../styles/index' as *;
|
|
119
|
+
|
|
120
|
+
.Input {
|
|
121
|
+
width: 100%;
|
|
122
|
+
height: 100%;
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
|
|
126
|
+
.Input--text {
|
|
127
|
+
flex: 1;
|
|
128
|
+
width: 100%;
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
}
|
|
131
|
+
.Input--ellipsis {
|
|
132
|
+
overflow-x: hidden;
|
|
133
|
+
text-overflow: ellipsis;
|
|
134
|
+
white-space: nowrap;
|
|
135
|
+
}
|
|
136
|
+
.Input--input {
|
|
137
|
+
flex: 1;
|
|
138
|
+
width: 100%;
|
|
139
|
+
height: 100%;
|
|
140
|
+
min-height: 1em;
|
|
141
|
+
padding: 0;
|
|
142
|
+
margin: 0;
|
|
143
|
+
}
|
|
144
|
+
.Input--input-placeholder {
|
|
145
|
+
color: UTILS__GLOBAL_VAR(color, placeholder);
|
|
146
|
+
}
|
|
147
|
+
.Input--icon {
|
|
148
|
+
flex: none;
|
|
149
|
+
font-size: 40rpx;
|
|
150
|
+
color: #999;
|
|
151
|
+
margin-left: 20rpx;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
</style>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="componentClassNames">
|
|
3
|
+
<input
|
|
4
|
+
:value="value"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:maxlength="maxlength"
|
|
7
|
+
:password="!isShowPassword"
|
|
8
|
+
:placeholder="placeholder"
|
|
9
|
+
always-embed
|
|
10
|
+
:class="$style['PasswordInput--input']"
|
|
11
|
+
:placeholder-class="$style['PasswordInput--input-placeholder']"
|
|
12
|
+
@input="$emit('input', $event.detail.value)"
|
|
13
|
+
/>
|
|
14
|
+
<icon-cpn
|
|
15
|
+
:icon="isShowPassword ? 'password-show' : 'password-hide'"
|
|
16
|
+
:class="$style['PasswordInput--icon']"
|
|
17
|
+
expand-tap-area
|
|
18
|
+
@click="isShowPassword = !isShowPassword"
|
|
19
|
+
></icon-cpn>
|
|
20
|
+
</view>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import componentName from '../../mixins/componentName';
|
|
25
|
+
import IconCpn from '../icon/icon.vue';
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
name: 'AppPasswordInput',
|
|
29
|
+
options: {
|
|
30
|
+
virtualHost: true,
|
|
31
|
+
styleIsolation: 'shared',
|
|
32
|
+
},
|
|
33
|
+
components: { IconCpn },
|
|
34
|
+
mixins: [componentName],
|
|
35
|
+
props: {
|
|
36
|
+
/** 绑定值 */
|
|
37
|
+
value: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: '',
|
|
40
|
+
},
|
|
41
|
+
/** 是否禁用 */
|
|
42
|
+
disabled: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
|
+
/** 最大输入长度 */
|
|
47
|
+
maxlength: {
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 140,
|
|
50
|
+
},
|
|
51
|
+
/** 占位文本 */
|
|
52
|
+
placeholder: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: '请输入密码',
|
|
55
|
+
},
|
|
56
|
+
/** 是否只读 */
|
|
57
|
+
readonly: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
data() {
|
|
63
|
+
return {
|
|
64
|
+
/** 是否显示明文 */
|
|
65
|
+
isShowPassword: false,
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<style lang="scss" module>
|
|
72
|
+
@use '../../styles/index' as *;
|
|
73
|
+
|
|
74
|
+
.PasswordInput {
|
|
75
|
+
width: 100%;
|
|
76
|
+
height: 100%;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
|
|
80
|
+
.PasswordInput--input {
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 100%;
|
|
83
|
+
}
|
|
84
|
+
.PasswordInput--input-placeholder {
|
|
85
|
+
color: UTILS__GLOBAL_VAR(color, placeholder);
|
|
86
|
+
}
|
|
87
|
+
.PasswordInput--icon {
|
|
88
|
+
flex: none;
|
|
89
|
+
font-size: 40rpx;
|
|
90
|
+
color: #999;
|
|
91
|
+
margin-left: 20rpx;
|
|
92
|
+
#{UTILS__VAR_NAME(tap-size, icon)}: 80rpx;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
</style>
|