v-uni-app-ui 1.0.2 → 1.0.6
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 +127 -0
- package/dist/v-uni-app-ui.css +1 -0
- package/dist/v-uni-app-ui.es.js +6569 -0
- package/dist/v-uni-app-ui.umd.js +7 -0
- package/package.json +28 -8
- package/components/config.js +0 -123
- package/components/layout/v-card/v-card.vue +0 -108
- package/components/layout/v-grid/v-grid.vue +0 -162
- package/components/layout/v-icon-grid/v-icon-grid.vue +0 -195
- package/components/layout/v-infinite-scroll/v-infinite-scroll.vue +0 -172
- package/components/layout/v-list/v-list.vue +0 -43
- package/components/layout/v-row/v-row.vue +0 -142
- package/components/layout/v-waterfall/v-waterfall.vue +0 -79
- package/components/model/compound/v-checkbox-group/v-checkbox-group.vue +0 -96
- package/components/model/compound/v-console/v-console.js +0 -20
- package/components/model/compound/v-console/v-console.vue +0 -299
- package/components/model/compound/v-date-time/v-date-time.vue +0 -261
- package/components/model/compound/v-dialog/v-dialog.vue +0 -178
- package/components/model/compound/v-drum-select-picker/v-drum-select-picker.vue +0 -83
- package/components/model/compound/v-form/v-form.vue +0 -226
- package/components/model/compound/v-form-item/v-form-item.vue +0 -255
- package/components/model/compound/v-image/v-image.vue +0 -357
- package/components/model/compound/v-input-desensitize/v-input-desensitize.vue +0 -101
- package/components/model/compound/v-page/v-page.vue +0 -11
- package/components/model/compound/v-pages/v-pages.vue +0 -141
- package/components/model/compound/v-picker-list/v-picker-list.vue +0 -109
- package/components/model/compound/v-popup/v-popup.vue +0 -151
- package/components/model/compound/v-radio-group/v-radio-group.vue +0 -86
- package/components/model/compound/v-select-picker/v-select-picker.vue +0 -202
- package/components/model/compound/v-series-picker-list/v-series-picker-list.vue +0 -221
- package/components/model/compound/v-series-select-picker/v-series-select-picker.vue +0 -203
- package/components/model/compound/v-switch/v-switch.vue +0 -136
- package/components/model/compound/v-tabs-page/v-tabs-page.vue +0 -138
- package/components/model/native/v-badge/v-badge.vue +0 -143
- package/components/model/native/v-button/v-button.vue +0 -273
- package/components/model/native/v-carousel/v-carousel.vue +0 -138
- package/components/model/native/v-checkbox/v-checkbox.vue +0 -215
- package/components/model/native/v-collapse/v-collapse.vue +0 -190
- package/components/model/native/v-header-navigation-bar/v-header-navigation-bar.vue +0 -92
- package/components/model/native/v-input/v-input.vue +0 -352
- package/components/model/native/v-input-code/v-input-code.vue +0 -146
- package/components/model/native/v-loading/v-loading.vue +0 -206
- package/components/model/native/v-menu/v-menu.vue +0 -222
- package/components/model/native/v-menu-slide/v-menu-slide.vue +0 -364
- package/components/model/native/v-min-loading/v-min-loading.vue +0 -80
- package/components/model/native/v-null/v-null.vue +0 -97
- package/components/model/native/v-overlay/v-overlay.vue +0 -96
- package/components/model/native/v-pull-up-refresh/v-pull-up-refresh.vue +0 -157
- package/components/model/native/v-radio/v-radio.vue +0 -138
- package/components/model/native/v-scroll-list/v-scroll-list.vue +0 -169
- package/components/model/native/v-steps/v-steps.vue +0 -253
- package/components/model/native/v-table/v-table.vue +0 -203
- package/components/model/native/v-tabs/v-tabs.vue +0 -235
- package/components/model/native/v-tag/v-tag.vue +0 -206
- package/components/model/native/v-text/v-text.vue +0 -187
- package/components/model/native/v-text-button/v-text-button.vue +0 -139
- package/components/model/native/v-textarea/v-textarea.vue +0 -178
- package/components/model/native/v-title/v-title.vue +0 -91
- package/components/model/native/v-toast/info.png +0 -0
- package/components/model/native/v-toast/success.png +0 -0
- package/components/model/native/v-toast/v-toast.vue +0 -198
- package/components/model/native/v-toast/warn.png +0 -0
- package/components/model/native/v-upload-file-button/v-upload-file-button.vue +0 -296
- package/components/model/native/v-video/v-video.vue +0 -175
- package/components/model/native/v-window/v-window.vue +0 -158
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="v-collapse">
|
|
3
|
-
<view v-for="(item, index) in items" :key="index" :class="['collapse-item', { expanded: item.expanded }]">
|
|
4
|
-
<view class="collapse-header" @click="toggleItem(index)">
|
|
5
|
-
<view class="header-title">{{ item.title }}</view>
|
|
6
|
-
<view v-if="!item.isRightIcon" class="header-icon">
|
|
7
|
-
<view class="arrow" :class="{ rotated: item.expanded }"></view>
|
|
8
|
-
</view>
|
|
9
|
-
</view>
|
|
10
|
-
<view class="collapse-content">
|
|
11
|
-
<view class="content-inner">
|
|
12
|
-
<slot name="content" :item="item">
|
|
13
|
-
{{ item.content }}
|
|
14
|
-
</slot>
|
|
15
|
-
</view>
|
|
16
|
-
</view>
|
|
17
|
-
</view>
|
|
18
|
-
</view>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script lang="ts" setup>
|
|
22
|
-
import { ref, watch,inject } from 'vue';
|
|
23
|
-
|
|
24
|
-
interface CollapseItem {
|
|
25
|
-
title: string;
|
|
26
|
-
content: string;
|
|
27
|
-
expanded: boolean;
|
|
28
|
-
name?: string;
|
|
29
|
-
isRightIcon?: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const props = defineProps({
|
|
33
|
-
items: {
|
|
34
|
-
type: Array as () => CollapseItem[],
|
|
35
|
-
required: true,
|
|
36
|
-
default: () => []
|
|
37
|
-
},
|
|
38
|
-
accordion: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: true
|
|
41
|
-
},
|
|
42
|
-
activeIndex: {
|
|
43
|
-
type: Number,
|
|
44
|
-
default: 0
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const emit = defineEmits(['update:activeIndex', 'change']);
|
|
49
|
-
|
|
50
|
-
const config = inject<any>('config');
|
|
51
|
-
const items = ref<CollapseItem[]>([...props.items]);
|
|
52
|
-
|
|
53
|
-
const initExpandedState = () => {
|
|
54
|
-
items.value.forEach((item, index) => {
|
|
55
|
-
item.expanded = index === props.activeIndex;
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
watch(
|
|
60
|
-
() => props.activeIndex,
|
|
61
|
-
(newIndex) => {
|
|
62
|
-
if (props.accordion) {
|
|
63
|
-
items.value.forEach((item, index) => {
|
|
64
|
-
item.expanded = index === newIndex;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
initExpandedState();
|
|
71
|
-
|
|
72
|
-
const toggleItem = (index: number) => {
|
|
73
|
-
const item = items.value[index];
|
|
74
|
-
|
|
75
|
-
if (props.accordion) {
|
|
76
|
-
items.value.forEach((otherItem, otherIndex) => {
|
|
77
|
-
otherItem.expanded = otherIndex === index ? !item.expanded : false;
|
|
78
|
-
});
|
|
79
|
-
} else {
|
|
80
|
-
item.expanded = !item.expanded;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const activeIndex = items.value.findIndex((item) => item.expanded);
|
|
84
|
-
emit('update:activeIndex', activeIndex);
|
|
85
|
-
emit('change', activeIndex);
|
|
86
|
-
};
|
|
87
|
-
</script>
|
|
88
|
-
|
|
89
|
-
<style lang="scss" scoped>
|
|
90
|
-
.v-collapse {
|
|
91
|
-
width: 100%;
|
|
92
|
-
overflow: hidden;
|
|
93
|
-
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
|
|
94
|
-
|
|
95
|
-
.collapse-item {
|
|
96
|
-
margin-bottom: 12rpx;
|
|
97
|
-
overflow: hidden;
|
|
98
|
-
background: transparent;
|
|
99
|
-
transition: all 0.5s ease;
|
|
100
|
-
border-top: 1rpx solid v-bind("config.border.color");
|
|
101
|
-
border-bottom: 1rpx solid v-bind("config.border.color");
|
|
102
|
-
|
|
103
|
-
&:last-child {
|
|
104
|
-
margin-bottom: 0;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.collapse-header {
|
|
108
|
-
display: flex;
|
|
109
|
-
justify-content: space-between;
|
|
110
|
-
align-items: center;
|
|
111
|
-
padding: 18rpx 24rpx;
|
|
112
|
-
font-weight: 600;
|
|
113
|
-
font-size: 24rpx;
|
|
114
|
-
cursor: pointer;
|
|
115
|
-
transition: all 0.3s ease;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.header-icon {
|
|
119
|
-
width: 24rpx;
|
|
120
|
-
height: 24rpx;
|
|
121
|
-
display: flex;
|
|
122
|
-
align-items: center;
|
|
123
|
-
justify-content: center;
|
|
124
|
-
|
|
125
|
-
.arrow {
|
|
126
|
-
width: 15rpx;
|
|
127
|
-
height: 15rpx;
|
|
128
|
-
border-right: 4rpx solid v-bind("config.border.color");
|
|
129
|
-
border-bottom: 4rpx solid v-bind("config.border.color");
|
|
130
|
-
transform: rotate(45deg);
|
|
131
|
-
transition: transform 0.5s ease;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.rotated {
|
|
135
|
-
transform: rotate(225deg);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.collapse-content {
|
|
140
|
-
max-height: 0;
|
|
141
|
-
overflow: hidden;
|
|
142
|
-
transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.5s;
|
|
143
|
-
box-shadow: 0 4rpx 6rpx rgba(0, 0, 0, 0.05);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.content-inner {
|
|
147
|
-
padding: 24rpx;
|
|
148
|
-
line-height: 1.7;
|
|
149
|
-
transform: translateY(10rpx);
|
|
150
|
-
opacity: 0;
|
|
151
|
-
transition: transform 0.3s ease, opacity 0.3s ease;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
&.expanded .collapse-content {
|
|
155
|
-
max-height: 1000rpx;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
&.expanded .content-inner {
|
|
159
|
-
transform: translateY(0);
|
|
160
|
-
opacity: 1;
|
|
161
|
-
transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// 响应式设计
|
|
165
|
-
@media (max-width: 768px) {
|
|
166
|
-
.collapse-header {
|
|
167
|
-
padding: 16rpx 20rpx;
|
|
168
|
-
font-size: v-bind("config.fontSize.mediumTitle");
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.content-inner {
|
|
172
|
-
padding: 20rpx;
|
|
173
|
-
font-size: v-bind("config.fontSize.largeText");
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
@media (max-width: 480px) {
|
|
178
|
-
.collapse-header {
|
|
179
|
-
padding: 14rpx 16rpx;
|
|
180
|
-
font-size: v-bind("config.fontSize.smallTitle");
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.content-inner {
|
|
184
|
-
padding: 16rpx;
|
|
185
|
-
font-size: v-bind("config.fontSize.mediumText");
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
</style>
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="v-header-navigation-bar" :style="{ backgroundColor: backgroundColor }">
|
|
3
|
-
<view class="v-header-navigation-bar-left" @click="handleBack">
|
|
4
|
-
<slot name="left">
|
|
5
|
-
<view class="v-header-navigation-bar-back-icon" v-if="showBack"></view>
|
|
6
|
-
</slot>
|
|
7
|
-
</view>
|
|
8
|
-
<view class="v-header-navigation-bar-title">
|
|
9
|
-
<slot>
|
|
10
|
-
<text>{{ title }}</text>
|
|
11
|
-
</slot>
|
|
12
|
-
</view>
|
|
13
|
-
<view class="v-header-navigation-bar-right">
|
|
14
|
-
<slot name="right"></slot>
|
|
15
|
-
</view>
|
|
16
|
-
</view>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script lang="ts" setup>
|
|
20
|
-
import { ref,inject } from 'vue';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* v-header-navigation-bar 导航栏
|
|
24
|
-
* title 标题
|
|
25
|
-
* backgroundColor 背景颜色
|
|
26
|
-
* showBack 是否需要返回按钮
|
|
27
|
-
*/
|
|
28
|
-
const props = defineProps({
|
|
29
|
-
title: {
|
|
30
|
-
type: String,
|
|
31
|
-
default: ''
|
|
32
|
-
},
|
|
33
|
-
backgroundColor: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: '#ffffff'
|
|
36
|
-
},
|
|
37
|
-
showBack: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: true
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const emits = defineEmits(['back']);
|
|
44
|
-
|
|
45
|
-
const config = inject<any>('config');
|
|
46
|
-
const handleBack = () => {
|
|
47
|
-
if (props.showBack) {
|
|
48
|
-
emits('back');
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<style lang="scss" scoped>
|
|
54
|
-
.v-header-navigation-bar {
|
|
55
|
-
display: flex;
|
|
56
|
-
align-items: center;
|
|
57
|
-
justify-content: space-between;
|
|
58
|
-
padding: 10rpx 16rpx;
|
|
59
|
-
box-sizing: border-box;
|
|
60
|
-
height: 5vh;
|
|
61
|
-
border-bottom: 1px solid v-bind("config.border.color");
|
|
62
|
-
position: relative;
|
|
63
|
-
z-index: 1000;
|
|
64
|
-
}
|
|
65
|
-
.v-header-navigation-bar-left {
|
|
66
|
-
margin-left: 2%;
|
|
67
|
-
}
|
|
68
|
-
.v-header-navigation-bar-left,
|
|
69
|
-
.v-header-navigation-bar-right {
|
|
70
|
-
display: flex;
|
|
71
|
-
align-items: center;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.v-header-navigation-bar-back-icon {
|
|
75
|
-
width: 24rpx;
|
|
76
|
-
height: 24rpx;
|
|
77
|
-
border: 4rpx solid v-bind("config.fontColor.mianTitle");
|
|
78
|
-
border-top: none;
|
|
79
|
-
border-right: none;
|
|
80
|
-
transform: rotate(45deg);
|
|
81
|
-
margin-right: 10px;
|
|
82
|
-
cursor: pointer;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.v-header-navigation-bar-title {
|
|
86
|
-
flex: 1;
|
|
87
|
-
text-align: center;
|
|
88
|
-
font-size: v-bind("config.fontSize.mediumTitle");
|
|
89
|
-
font-weight: bold;
|
|
90
|
-
color: v-bind("config.fontColor.mianTitle");
|
|
91
|
-
}
|
|
92
|
-
</style>
|
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view :class="['input-combination', `input-combination--${size}`]">
|
|
3
|
-
<view :class="['combination', 'left-combination']" v-if="combinationConfig.isShow && combinationConfig.position === 'left' || combinationConfig.position === 'ends'">
|
|
4
|
-
<slot name="left">
|
|
5
|
-
<button>{{ combinationConfig.buttonText }}</button>
|
|
6
|
-
</slot>
|
|
7
|
-
</view>
|
|
8
|
-
<view :class="['input-container', `input-container--${combinationConfig.position}`]">
|
|
9
|
-
<input
|
|
10
|
-
:value="inputValue"
|
|
11
|
-
:class="[
|
|
12
|
-
'v-input',
|
|
13
|
-
{ 'v-input--disabled': disabled },
|
|
14
|
-
{ 'input-focused': focused },
|
|
15
|
-
`v-input--border--${borderModel}`,
|
|
16
|
-
`v-input--right--combination--${combinationConfig.position}`
|
|
17
|
-
]"
|
|
18
|
-
:placeholder="currentPlaceholder"
|
|
19
|
-
:maxlength="maxlength || undefined"
|
|
20
|
-
:disabled="disabled"
|
|
21
|
-
:type="type"
|
|
22
|
-
:focus="autoFocus"
|
|
23
|
-
@input="handleInput"
|
|
24
|
-
@focus="handleFocus"
|
|
25
|
-
@blur="handleBlur"
|
|
26
|
-
@confirm="handleConfirm"
|
|
27
|
-
/>
|
|
28
|
-
<view v-if="showCounter && maxlength" class="input-counter">{{ currentLength }}/{{ maxlength }}</view>
|
|
29
|
-
</view>
|
|
30
|
-
<view :class="['combination', 'right-combination']" v-if="combinationConfig.isShow && combinationConfig.position === 'right' || combinationConfig.position === 'ends'">
|
|
31
|
-
<slot name="right">
|
|
32
|
-
<button>{{ combinationConfig.buttonText }}</button>
|
|
33
|
-
</slot>
|
|
34
|
-
</view>
|
|
35
|
-
</view>
|
|
36
|
-
</template>
|
|
37
|
-
|
|
38
|
-
<script setup lang="ts">
|
|
39
|
-
import { ref, watch, onMounted, onUnmounted, inject } from 'vue';
|
|
40
|
-
|
|
41
|
-
interface CombinationConfig {
|
|
42
|
-
isShow: Boolean;
|
|
43
|
-
position: String;
|
|
44
|
-
buttonText: String;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* v-input 输入框
|
|
49
|
-
* value 双向绑定值
|
|
50
|
-
* size 文本框大小 默认值:medium 可选值small小、medium中、large大
|
|
51
|
-
* placeholder 提示语 字符串、数组
|
|
52
|
-
* placeholderTimeNumber 更换提示词耗时 默认:8秒
|
|
53
|
-
* maxlength 最大输入值 默认:null 不限制
|
|
54
|
-
* disabled 是否禁用 默认:false 可选值:true禁用 false不禁用
|
|
55
|
-
* type 文本框类型 默认:text 可选值:text、password、number
|
|
56
|
-
* showCounter 是否显示统计文字 默认:false 可选值:true显示统计文字 false不显示统计文字
|
|
57
|
-
* borderModel 边框模式 默认:all 可选值:all普通边框 nont无边框模式 bottom底部边框模式 top上边框模式 left左边框模式 right右边框模式 ends左右两端边框模式 up-down上下边框模式
|
|
58
|
-
* combinationConfig 组合组件
|
|
59
|
-
* isShow:是否显示插槽 默认值:false 可选值:true显示 false不显示
|
|
60
|
-
* position:组合组件显示位置 默认值:default 可选值:right右边 left左边 ends两端
|
|
61
|
-
* 插槽right、left
|
|
62
|
-
* 相关事件:focus、blur、confirm
|
|
63
|
-
*/
|
|
64
|
-
const props = defineProps({
|
|
65
|
-
value: {
|
|
66
|
-
type: String,
|
|
67
|
-
default: '',
|
|
68
|
-
required: true
|
|
69
|
-
},
|
|
70
|
-
size: {
|
|
71
|
-
type: String,
|
|
72
|
-
default: 'medium',
|
|
73
|
-
validator: (value: string) => ['small', 'medium', 'large'].includes(value)
|
|
74
|
-
},
|
|
75
|
-
placeholder: {
|
|
76
|
-
type: [String, Array],
|
|
77
|
-
default: ''
|
|
78
|
-
},
|
|
79
|
-
placeholderTimeNumber: {
|
|
80
|
-
type: Number,
|
|
81
|
-
default: 8000
|
|
82
|
-
},
|
|
83
|
-
maxlength: {
|
|
84
|
-
type: Number,
|
|
85
|
-
default: null
|
|
86
|
-
},
|
|
87
|
-
disabled: {
|
|
88
|
-
type: Boolean,
|
|
89
|
-
default: false
|
|
90
|
-
},
|
|
91
|
-
type: {
|
|
92
|
-
type: String,
|
|
93
|
-
default: 'text',
|
|
94
|
-
validator: (value: string) => ['text', 'password', 'number'].includes(value)
|
|
95
|
-
},
|
|
96
|
-
showCounter: {
|
|
97
|
-
type: Boolean,
|
|
98
|
-
default: false
|
|
99
|
-
},
|
|
100
|
-
borderModel: {
|
|
101
|
-
type: String,
|
|
102
|
-
default: 'all'
|
|
103
|
-
},
|
|
104
|
-
combinationConfig: {
|
|
105
|
-
type: Object as () => CombinationConfig,
|
|
106
|
-
default: {
|
|
107
|
-
isShow: false,
|
|
108
|
-
position: 'default',
|
|
109
|
-
buttonText: ''
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
inputTextPosition: {
|
|
113
|
-
type: String,
|
|
114
|
-
default: 'left'
|
|
115
|
-
},
|
|
116
|
-
autoFocus: {
|
|
117
|
-
type: Boolean,
|
|
118
|
-
default: false
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
const emit = defineEmits(['update:value', 'input', 'focus', 'blur', 'confirm']);
|
|
123
|
-
|
|
124
|
-
const config = inject<any>('config');
|
|
125
|
-
const inputValue = ref(props.value);
|
|
126
|
-
const focused = ref(false);
|
|
127
|
-
const currentLength = ref(props.value.length);
|
|
128
|
-
const currentPlaceholder = ref('');
|
|
129
|
-
const placeholderIndex = ref(0);
|
|
130
|
-
let placeholderInterval: NodeJS.Timeout | null = null;
|
|
131
|
-
|
|
132
|
-
watch(
|
|
133
|
-
() => props.value,
|
|
134
|
-
(newVal) => {
|
|
135
|
-
inputValue.value = newVal;
|
|
136
|
-
currentLength.value = newVal.length;
|
|
137
|
-
}
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
watch(
|
|
141
|
-
() => props.placeholder,
|
|
142
|
-
(newVal) => {
|
|
143
|
-
if (Array.isArray(newVal) && newVal.length > 0) {
|
|
144
|
-
currentPlaceholder.value = newVal[0];
|
|
145
|
-
placeholderIndex.value = 0;
|
|
146
|
-
} else if (typeof newVal === 'string') {
|
|
147
|
-
currentPlaceholder.value = newVal;
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
{ immediate: true }
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
onMounted(() => {
|
|
154
|
-
if (Array.isArray(props.placeholder) && props.placeholder.length > 1) {
|
|
155
|
-
startPlaceholderRotation();
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
onUnmounted(() => {
|
|
160
|
-
if (placeholderInterval) {
|
|
161
|
-
clearInterval(placeholderInterval);
|
|
162
|
-
placeholderInterval = null;
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
const startPlaceholderRotation = () => {
|
|
167
|
-
placeholderInterval = setInterval(() => {
|
|
168
|
-
placeholderIndex.value = (placeholderIndex.value + 1) % props.placeholder.length;
|
|
169
|
-
currentPlaceholder.value = props.placeholder[placeholderIndex.value];
|
|
170
|
-
}, props.placeholderTimeNumber);
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
const handleInput = (e: any) => {
|
|
174
|
-
const value = e.detail.value;
|
|
175
|
-
inputValue.value = value;
|
|
176
|
-
currentLength.value = value.length;
|
|
177
|
-
emit('update:value', value);
|
|
178
|
-
emit('input', value);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const handleFocus = (e: any) => {
|
|
182
|
-
focused.value = true;
|
|
183
|
-
emit('focus', e);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const handleBlur = (e: any) => {
|
|
187
|
-
focused.value = false;
|
|
188
|
-
emit('blur', e);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
//回车搜索
|
|
192
|
-
const handleConfirm = (e: any) => {
|
|
193
|
-
if (e.detail.value.trim() === '' && Array.isArray(props.placeholder) && currentPlaceholder.value) {
|
|
194
|
-
emit('confirm', currentPlaceholder.value, e);
|
|
195
|
-
} else {
|
|
196
|
-
emit('confirm', e.detail.value, e);
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
</script>
|
|
200
|
-
|
|
201
|
-
<style lang="scss" scoped>
|
|
202
|
-
.input-combination {
|
|
203
|
-
display: flex;
|
|
204
|
-
|
|
205
|
-
&--small {
|
|
206
|
-
height: 50rpx;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
&--medium {
|
|
210
|
-
height: 60rpx;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
&--large {
|
|
214
|
-
height: 70rpx;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.input-container {
|
|
218
|
-
width: 100%;
|
|
219
|
-
height: 100%;
|
|
220
|
-
position: relative;
|
|
221
|
-
|
|
222
|
-
&--default {
|
|
223
|
-
width: 100%;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
&--right,
|
|
227
|
-
&--left {
|
|
228
|
-
width: 75%;
|
|
229
|
-
}
|
|
230
|
-
&--ends {
|
|
231
|
-
width: 50%;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.v-input {
|
|
235
|
-
width: 100%;
|
|
236
|
-
height: 100%;
|
|
237
|
-
min-height: 45rpx;
|
|
238
|
-
box-sizing: border-box;
|
|
239
|
-
background-color: #fff;
|
|
240
|
-
font-size: v-bind("config.fontSize.mediumText");
|
|
241
|
-
line-height: 1.5;
|
|
242
|
-
transition: border-color 0.3s;
|
|
243
|
-
text-align: v-bind('props.inputTextPosition');
|
|
244
|
-
|
|
245
|
-
::v-deep .uni-input-wrapper {
|
|
246
|
-
width: 92% !important;
|
|
247
|
-
margin-left: 3%;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
&--border--all {
|
|
251
|
-
border: 1px solid v-bind('config.border.color');
|
|
252
|
-
border-radius: 6rpx;
|
|
253
|
-
|
|
254
|
-
&.input-focused {
|
|
255
|
-
border-color: v-bind('config.border.default');
|
|
256
|
-
box-shadow: v-bind("config.VInput.boxShadow");
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
&--border--none {
|
|
261
|
-
border: none;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
&--border--bottom {
|
|
265
|
-
border-bottom: 1rpx solid v-bind('config.border.color');
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
&--border--top {
|
|
269
|
-
border-top: 1rpx solid v-bind('config.border.color');
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
&--border--left {
|
|
273
|
-
border-left: 1rpx solid v-bind('config.border.color');
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
&--border--right {
|
|
277
|
-
border-right: 1rpx solid v-bind('config.border.color');
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
&--border--ends {
|
|
281
|
-
border-left: 1rpx solid v-bind('config.border.color');
|
|
282
|
-
border-right: 1rpx solid v-bind('config.border.color');
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
&--border--up-down {
|
|
286
|
-
border-top: 1rpx solid v-bind('config.border.color');
|
|
287
|
-
border-bottom: 1rpx solid v-bind('config.border.color');
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
&--right--combination--right {
|
|
291
|
-
border-right: none;
|
|
292
|
-
border-top-right-radius: 0;
|
|
293
|
-
border-bottom-right-radius: 0;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
&--right--combination--left {
|
|
297
|
-
border-left: none;
|
|
298
|
-
border-top-left-radius: 0;
|
|
299
|
-
border-bottom-left-radius: 0;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
&--right--combination--ends {
|
|
303
|
-
border-right: none;
|
|
304
|
-
border-top-right-radius: 0;
|
|
305
|
-
border-bottom-right-radius: 0;
|
|
306
|
-
|
|
307
|
-
border-left: none;
|
|
308
|
-
border-top-left-radius: 0;
|
|
309
|
-
border-bottom-left-radius: 0;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
&--disabled {
|
|
313
|
-
opacity: v-bind('config.opacity.disabled');
|
|
314
|
-
background-color: v-bind('config.backgroundColor.disabled');
|
|
315
|
-
color: v-bind('config.fontColor.text');
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
.input-counter {
|
|
319
|
-
position: absolute;
|
|
320
|
-
bottom: 8rpx;
|
|
321
|
-
right: 8rpx;
|
|
322
|
-
font-size: v-bind("config.fontSize.smallText");
|
|
323
|
-
color: v-bind('config.fontColor.text');
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.combination {
|
|
328
|
-
width: 25%;
|
|
329
|
-
height: 100%;
|
|
330
|
-
button {
|
|
331
|
-
width: 100%;
|
|
332
|
-
height: 100%;
|
|
333
|
-
display: flex;
|
|
334
|
-
align-items: center;
|
|
335
|
-
justify-content: center;
|
|
336
|
-
background-color: v-bind('config.backgroundColor.default');
|
|
337
|
-
color: v-bind('config.fontColor.reversal');
|
|
338
|
-
font-size: v-bind("config.fontSize.mediumText");
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.left-combination button {
|
|
343
|
-
border-bottom-right-radius: 0;
|
|
344
|
-
border-top-right-radius: 0;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.right-combination button {
|
|
348
|
-
border-bottom-left-radius: 0;
|
|
349
|
-
border-top-left-radius: 0;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
</style>
|