gxd-uni-library-editx 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/.editorconfig +14 -0
- package/README.md +447 -0
- package/index.js +3 -0
- package/package.json +104 -0
- package/postcss.config.js +22 -0
- package/settings.js.tpl +68 -0
- package/src/XdAppClass.1.0.js +257 -0
- package/src/XdAppClass.js +150 -0
- package/src/components/XdAddress/XdAddress.vue +579 -0
- package/src/components/XdAddressSelect/XdAddressSelect.vue +243 -0
- package/src/components/XdBaiduMap/XdBaiduMap.vue +204 -0
- package/src/components/XdBaiduOverlay/XdBaiduOverlay.vue +345 -0
- package/src/components/XdBaiduSearch/XdBaiduSearch.vue +354 -0
- package/src/components/XdBar/XdBar.vue +339 -0
- package/src/components/XdButton/XdButton.vue +288 -0
- package/src/components/XdCartList/XdCartList.vue +791 -0
- package/src/components/XdCartNoStoreList/XdCartNoStoreList.vue +747 -0
- package/src/components/XdCity/XdCity.vue +620 -0
- package/src/components/XdCity/city.js +93 -0
- package/src/components/XdCity/testData.js +124 -0
- package/src/components/XdCityLocation/XdCityLocation.vue +314 -0
- package/src/components/XdCityLocation/jweixin.js +72 -0
- package/src/components/XdCityShow/XdCityShow.vue +354 -0
- package/src/components/XdClipImage/XdClipImage.vue +879 -0
- package/src/components/XdCoins/XdCoins.vue +66 -0
- package/src/components/XdConfirm/XdConfirm.vue +240 -0
- package/src/components/XdContentXss/XdContentXss.vue +71 -0
- package/src/components/XdDailog/XdDailog.vue +258 -0
- package/src/components/XdDate/XdDataItemOne.vue +236 -0
- package/src/components/XdDate/XdDate.vue +1081 -0
- package/src/components/XdDate/XdDateItem.vue +316 -0
- package/src/components/XdDate/XdDateTime.vue +929 -0
- package/src/components/XdDate/i18n/en.json +19 -0
- package/src/components/XdDate/i18n/index.js +8 -0
- package/src/components/XdDate/i18n/zh-Hans.json +19 -0
- package/src/components/XdDate/i18n/zh-Hant.json +19 -0
- package/src/components/XdDate/keypress.js +45 -0
- package/src/components/XdDate/util.js +418 -0
- package/src/components/XdDownDrawer/XdDownDrawer.vue +176 -0
- package/src/components/XdEditPwd/XdEditPwd.vue +305 -0
- package/src/components/XdEnterOrderList/XdEnterOrderList.vue +413 -0
- package/src/components/XdExpressTimeLine/XdExpressTimeLine.vue +280 -0
- package/src/components/XdFilter/XdFilter.vue +541 -0
- package/src/components/XdFontIcon/XdFontIcon.vue +165 -0
- package/src/components/XdFontIcon/css/icon.less +498 -0
- package/src/components/XdFooterBar/XdFooterBar.vue +291 -0
- package/src/components/XdFooterTabbar/XdFooterTabbar.vue +284 -0
- package/src/components/XdForm/XdForm.vue +481 -0
- package/src/components/XdForm/validate.js +486 -0
- package/src/components/XdFormCheckbox/XdFormCheckbox.vue +858 -0
- package/src/components/XdFormDate.vue +187 -0
- package/src/components/XdFormInput/XdFormInput.vue +535 -0
- package/src/components/XdFormInput/common.js +56 -0
- package/src/components/XdFormItem/XdFormItem.vue +583 -0
- package/src/components/XdFormSelect/XdFormSelect.vue +119 -0
- package/src/components/XdImage/XdImage.vue +113 -0
- package/src/components/XdItemCardUser/XdItemCardUser.vue +232 -0
- package/src/components/XdItemFilmImage/XdItemFilmImage.vue +146 -0
- package/src/components/XdItemFilmText/XdItemFilmText.vue +83 -0
- package/src/components/XdItemPhysical/XdItemPhysical.vue +410 -0
- package/src/components/XdItemPhysicalPack/XdItemPhysicalPack.vue +240 -0
- package/src/components/XdItemStore/XdItemStore.vue +236 -0
- package/src/components/XdItemUserInfo/XdItemUserInfo.vue +175 -0
- package/src/components/XdJson/XdJson.vue +398 -0
- package/src/components/XdKeyValue/XdKeyValue.vue +150 -0
- package/src/components/XdLabelNew/XdLabelNew.vue +193 -0
- package/src/components/XdLayout/XdLayout.vue +634 -0
- package/src/components/XdLoading/XdLoading.vue +165 -0
- package/src/components/XdMore/XdMore.vue +66 -0
- package/src/components/XdMpHtml/XdMpHtml.vue +458 -0
- package/src/components/XdMpHtml/node/node.vue +536 -0
- package/src/components/XdMpHtml/parser.js +1260 -0
- package/src/components/XdMpHtml/static/js/handler.js +1 -0
- package/src/components/XdMpHtml/static/js/uni.webview.min.js +1 -0
- package/src/components/XdMpHtml/static/local.html +1 -0
- package/src/components/XdMy/XdMy.vue +294 -0
- package/src/components/XdMySuccess/XdMySuccess.vue +603 -0
- package/src/components/XdNavTab/XdNavTab.vue +147 -0
- package/src/components/XdNoData/XdNoData.vue +87 -0
- package/src/components/XdNoticeBar/XdNoticeBar.vue +501 -0
- package/src/components/XdNumber/XdNumber.vue +210 -0
- package/src/components/XdNumberUni/XdNumberUni.vue +270 -0
- package/src/components/XdNumberUni/readme.md +42 -0
- package/src/components/XdOnlineConfirm/XdOnlineConfirm.vue +385 -0
- package/src/components/XdOnlineDetail/XdOnlineDetail.vue +332 -0
- package/src/components/XdOnlinePay/XdOnlinePay.vue +349 -0
- package/src/components/XdOnlineSchedule/XdOnlineSchedule.vue +453 -0
- package/src/components/XdOnlineSeat/XdOnlineSeat.vue +796 -0
- package/src/components/XdOnlineSeatMove/XdOnlineSeatMove.vue +1012 -0
- package/src/components/XdPayCombo/XdPayCombo.vue +118 -0
- package/src/components/XdPreviewImage/XdPreviewImage.vue +372 -0
- package/src/components/XdPwPay/XdPwPay.vue +214 -0
- package/src/components/XdRadio/XdRadio.vue +151 -0
- package/src/components/XdRangeSlider/XdRangeSlider.vue +355 -0
- package/src/components/XdRedName/XdRedName.vue +35 -0
- package/src/components/XdSearchBar/XdSearchBar.vue +286 -0
- package/src/components/XdSelect/XdSelect.vue +382 -0
- package/src/components/XdSelectCity/XdSelectCity.vue +270 -0
- package/src/components/XdSelectTime/XdSelectTime.vue +342 -0
- package/src/components/XdStar/XdStar.vue +261 -0
- package/src/components/XdStoreCashier/XdStoreCashier.vue +526 -0
- package/src/components/XdStoreItem/XdStoreItem.vue +400 -0
- package/src/components/XdStoreOrderDetail/XdStoreOrderDetail.vue +1571 -0
- package/src/components/XdStoreOrderList/XdStoreOrderList.vue +450 -0
- package/src/components/XdStoreProductInfo/XdStoreProductInfo.vue +940 -0
- package/src/components/XdStoreProductType/XdStoreProductType.vue +307 -0
- package/src/components/XdSuccess/XdSuccess.vue +527 -0
- package/src/components/XdSwipeSelect/XdSwipeSelect.vue +99 -0
- package/src/components/XdSwiper/XdSwiper.vue +124 -0
- package/src/components/XdSwitch/XdSwitch.vue +204 -0
- package/src/components/XdTab/XdTab.vue +220 -0
- package/src/components/XdTabScroll/XdTabScroll.vue +212 -0
- package/src/components/XdTag/XdTag.vue +423 -0
- package/src/components/XdTimeLine/XdTimeLine.vue +121 -0
- package/src/components/XdTips/XdTips.vue +212 -0
- package/src/components/XdTipsBlock/XdTipsBlock.vue +141 -0
- package/src/components/XdTitleSection/XdTitleSection.vue +152 -0
- package/src/components/XdTitleTab/XdTitleTab.vue +227 -0
- package/src/components/XdUnit/XdUnit.vue +206 -0
- package/src/components/XdUpload/XdUpload.vue +197 -0
- package/src/components/XdUploadImage/XdUploadImage.vue +145 -0
- package/src/components/Xdlogs/XdLogs.vue +144 -0
- package/src/components/autoload.js +211 -0
- package/src/components/swipeAction/UniSwipeAction.vue +43 -0
- package/src/components/swipeActionItem/UniSwipeActionItem.vue +386 -0
- package/src/components/swipeActionItem/bindingx.js +298 -0
- package/src/components/swipeActionItem/index.wxs +321 -0
- package/src/components/swipeActionItem/isPC.js +18 -0
- package/src/components/swipeActionItem/mpalipay.js +210 -0
- package/src/components/swipeActionItem/mpother.js +252 -0
- package/src/components/swipeActionItem/mpwxs.js +140 -0
- package/src/dome/dome/address.vue +415 -0
- package/src/dome/dome/auth/login.vue +166 -0
- package/src/dome/dome/baidu_show.vue +20 -0
- package/src/dome/dome/cake.vue +186 -0
- package/src/dome/dome/cart.vue +205 -0
- package/src/dome/dome/cart_store.vue +149 -0
- package/src/dome/dome/cashier/cashier.vue +73 -0
- package/src/dome/dome/cashier/check_cashier.vue +469 -0
- package/src/dome/dome/cashier/success.vue +127 -0
- package/src/dome/dome/city.vue +148 -0
- package/src/dome/dome/cityData.js +9 -0
- package/src/dome/dome/clip.vue +82 -0
- package/src/dome/dome/date/date.vue +273 -0
- package/src/dome/dome/date/selected.js +315 -0
- package/src/dome/dome/dcom/app1.vue +13 -0
- package/src/dome/dome/dcom/app2.vue +13 -0
- package/src/dome/dome/dcom/app3.vue +13 -0
- package/src/dome/dome/dcom/app4.vue +13 -0
- package/src/dome/dome/dcom/app5.vue +13 -0
- package/src/dome/dome/dcom/index.vue +1 -0
- package/src/dome/dome/debug/debug.vue +95 -0
- package/src/dome/dome/docache/docache.vue +88 -0
- package/src/dome/dome/express.vue +269 -0
- package/src/dome/dome/form.vue +312 -0
- package/src/dome/dome/icon.js +125 -0
- package/src/dome/dome/icon.vue +93 -0
- package/src/dome/dome/index.vue +725 -0
- package/src/dome/dome/item.vue +236 -0
- package/src/dome/dome/json/json.vue +88 -0
- package/src/dome/dome/layout.vue +105 -0
- package/src/dome/dome/line.vue +113 -0
- package/src/dome/dome/map/search.vue +70 -0
- package/src/dome/dome/my.vue +171 -0
- package/src/dome/dome/notice.vue +93 -0
- package/src/dome/dome/online/confirm.vue +92 -0
- package/src/dome/dome/online/detail.vue +80 -0
- package/src/dome/dome/online/pay.vue +78 -0
- package/src/dome/dome/online/schedule.vue +73 -0
- package/src/dome/dome/online/seat.vue +98 -0
- package/src/dome/dome/order/detail.vue +166 -0
- package/src/dome/dome/order/enter_order.vue +294 -0
- package/src/dome/dome/order/list.vue +219 -0
- package/src/dome/dome/order/order.js +18 -0
- package/src/dome/dome/order/success.vue +68 -0
- package/src/dome/dome/product.vue +179 -0
- package/src/dome/dome/store_cashier.vue +67 -0
- package/src/dome/dome/swiper.vue +32 -0
- package/src/dome/dome/webview.vue +61 -0
- package/src/install.js +183 -0
- package/src/main/address/address.vue +251 -0
- package/src/main/cart/cart.vue +149 -0
- package/src/main/cashier/cashier.vue +72 -0
- package/src/main/cashier/check_cashier.vue +483 -0
- package/src/main/city/city.vue +149 -0
- package/src/main/date/date.vue +260 -0
- package/src/main/order/order.js +19 -0
- package/src/main/order/order.vue +222 -0
- package/src/main/product/detail.vue +121 -0
- package/src/main/product/type.vue +108 -0
- package/src/main/search/search.vue +501 -0
- package/src/pages.json +337 -0
- package/src/plugins/CreatedComponentsPlugin.js +19 -0
- package/src/plugins/JsonRename.js +72 -0
- package/src/plugins/SetAppParams.js +171 -0
- package/src/project.js +18 -0
- package/src/utils/Cookie.js +68 -0
- package/src/utils/Runtime.js +105 -0
- package/src/utils/Storage.js +104 -0
- package/src/utils/XdNetwork.js +133 -0
- package/src/utils/helper.js +1321 -0
- package/src/utils/nourl.js +95 -0
- package/src/utils/project.js +17 -0
- package/src/utils/xd.auth.js +61 -0
- package/src/utils/xd.base.js +474 -0
- package/src/utils/xd.common.js +240 -0
- package/src/utils/xd.event.js +99 -0
- package/src/utils/xd.frame.js +96 -0
- package/src/utils/xd.path.js +96 -0
- package/src/utils/xdAppLog.js +170 -0
- package/src/utils/xdWxLog.js +302 -0
- package/src/utils/xdh5log.js +307 -0
- package/src/websetting.js +64 -0
- package/tsconfig.json +9 -0
- package/xd.less +180 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="xd-form-date">
|
|
3
|
+
<view class="xd-form-date__input">
|
|
4
|
+
<xd-form-input
|
|
5
|
+
v-model="date"
|
|
6
|
+
@focus="handleClearStyle(1)"
|
|
7
|
+
@blur="handleClearStyle(0)"
|
|
8
|
+
:placeholder="placeholder"
|
|
9
|
+
></xd-form-input>
|
|
10
|
+
</view>
|
|
11
|
+
<view class="xd-form-date__icon" @click.stop="handleClick">
|
|
12
|
+
<xd-font-icon
|
|
13
|
+
icon="iconxuanzeriqi"
|
|
14
|
+
color="#333"
|
|
15
|
+
size="40"
|
|
16
|
+
></xd-font-icon>
|
|
17
|
+
</view>
|
|
18
|
+
<view
|
|
19
|
+
class="xd-form-date__clear"
|
|
20
|
+
@click.stop="handleClear"
|
|
21
|
+
:class="{
|
|
22
|
+
'visibility-visible': clear && date,
|
|
23
|
+
'visibility-hidden': !clear || !date,
|
|
24
|
+
}"
|
|
25
|
+
>
|
|
26
|
+
<xd-font-icon
|
|
27
|
+
icon="iconyduicuowushixin"
|
|
28
|
+
color="#999"
|
|
29
|
+
size="32"
|
|
30
|
+
></xd-font-icon>
|
|
31
|
+
</view>
|
|
32
|
+
<xd-date
|
|
33
|
+
:date="defaultTime"
|
|
34
|
+
:show.sync="show"
|
|
35
|
+
:select-type="false"
|
|
36
|
+
:current-is-show-other-month="true"
|
|
37
|
+
:clearDate="false"
|
|
38
|
+
:showMonth="false"
|
|
39
|
+
:range="false"
|
|
40
|
+
:insert="false"
|
|
41
|
+
:is-show-dat="false"
|
|
42
|
+
:pleStatus="endMultipleStatus"
|
|
43
|
+
@confirm="monthSwitch"
|
|
44
|
+
:z-index="zIndex"
|
|
45
|
+
:type-has-time="showHourAndMinute"
|
|
46
|
+
:hide-second="!showSecond"
|
|
47
|
+
></xd-date>
|
|
48
|
+
</view>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script>
|
|
52
|
+
import XdFormInput from "@/components/XdFormInput/XdFormInput";
|
|
53
|
+
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
54
|
+
import XdDate from "@/components/XdDate/XdDate";
|
|
55
|
+
export default {
|
|
56
|
+
name: "XdFormDate",
|
|
57
|
+
components: {
|
|
58
|
+
XdFontIcon,
|
|
59
|
+
XdFormInput,
|
|
60
|
+
XdDate
|
|
61
|
+
},
|
|
62
|
+
props: {
|
|
63
|
+
//返回时间戳格式(毫秒)
|
|
64
|
+
defaultValue: {
|
|
65
|
+
type: Number|null,
|
|
66
|
+
default: null,
|
|
67
|
+
},
|
|
68
|
+
placeholder:{
|
|
69
|
+
type: String,
|
|
70
|
+
default: '请选择日期',
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
//显示小时与分钟
|
|
74
|
+
showHourAndMinute: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: true,
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
zIndex: {
|
|
80
|
+
type: Number,
|
|
81
|
+
default: 3001
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
showSecond: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: false,
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
data(){
|
|
90
|
+
return {
|
|
91
|
+
clear: false,
|
|
92
|
+
defaultTime: null,
|
|
93
|
+
show: false,
|
|
94
|
+
date: '',
|
|
95
|
+
focus: false,
|
|
96
|
+
endMultipleStatus: {
|
|
97
|
+
before: '',
|
|
98
|
+
after: '',
|
|
99
|
+
data: [],
|
|
100
|
+
fulldate: ''
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
created() {
|
|
105
|
+
if(this.defaultValue) {
|
|
106
|
+
let date = new Date(Number(this.defaultValue));
|
|
107
|
+
if(!this.showHourAndMinute) {
|
|
108
|
+
this.date = this.$xdUniHelper.getDate(date).fullDate
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.date = this.$xdUniHelper.getDate(date).fullTime
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
},
|
|
117
|
+
methods: {
|
|
118
|
+
handleClear(){
|
|
119
|
+
this.date = '';
|
|
120
|
+
this.$emit('input', '');
|
|
121
|
+
this.$emit('change', null);
|
|
122
|
+
this.$emit('clear');
|
|
123
|
+
},
|
|
124
|
+
handleClearStyle(type){
|
|
125
|
+
this.clear = type === 1;
|
|
126
|
+
},
|
|
127
|
+
handleClick(){
|
|
128
|
+
this.show = true;
|
|
129
|
+
},
|
|
130
|
+
monthSwitch(e) {
|
|
131
|
+
if (!this.showHourAndMinute) {
|
|
132
|
+
this.date = e.fulldate
|
|
133
|
+
} else {
|
|
134
|
+
this.date = e.fullTime;
|
|
135
|
+
}
|
|
136
|
+
this.$emit('input', e.timestamp);
|
|
137
|
+
this.$emit('change', e);
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<style scoped lang="less">
|
|
145
|
+
.visibility {
|
|
146
|
+
&-visible {
|
|
147
|
+
visibility: visible;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&-hidden {
|
|
151
|
+
visibility: hidden;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
.xd-form-date {
|
|
155
|
+
position: relative;
|
|
156
|
+
|
|
157
|
+
&__input {
|
|
158
|
+
position: relative;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&__clear {
|
|
162
|
+
position: absolute;
|
|
163
|
+
top: unit(14, rpx);
|
|
164
|
+
right: unit(60, rpx);
|
|
165
|
+
width: unit(50, rpx);
|
|
166
|
+
height: unit(50, rpx);
|
|
167
|
+
display: flex;
|
|
168
|
+
justify-content: center;
|
|
169
|
+
align-items: center;
|
|
170
|
+
z-index: 199;
|
|
171
|
+
opacity: .7;
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&__icon {
|
|
176
|
+
position: absolute;
|
|
177
|
+
top: unit(10,rpx);
|
|
178
|
+
right: unit(10, rpx);
|
|
179
|
+
width: unit(50,rpx);
|
|
180
|
+
height: unit(50, rpx);
|
|
181
|
+
display: flex;
|
|
182
|
+
justify-content: center;
|
|
183
|
+
align-items: center;
|
|
184
|
+
z-index: 199;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
</style>
|
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="uni-easyinput"
|
|
4
|
+
v-if="contentAlign"
|
|
5
|
+
:class="{
|
|
6
|
+
'uni-easyinput-error':msg
|
|
7
|
+
}"
|
|
8
|
+
:style="{
|
|
9
|
+
color:inputBorder && msg?'#e43d33':styles.color
|
|
10
|
+
}"
|
|
11
|
+
>
|
|
12
|
+
<view
|
|
13
|
+
class="uni-easyinput__content"
|
|
14
|
+
:class="{
|
|
15
|
+
'is-input-border':inputBorder ,
|
|
16
|
+
'is-input-error-border':inputBorder && msg,
|
|
17
|
+
'is-textarea':type==='textarea',
|
|
18
|
+
'is-disabled':disabled,
|
|
19
|
+
}"
|
|
20
|
+
:style="{
|
|
21
|
+
'border-color':inputBorder && msg?'#dd524d':styles.borderColor,
|
|
22
|
+
'background-color':disabled?styles.disableColor:'',
|
|
23
|
+
'text-align': contentAlign
|
|
24
|
+
}"
|
|
25
|
+
>
|
|
26
|
+
<textarea
|
|
27
|
+
v-if="type === 'textarea'"
|
|
28
|
+
class="uni-easyinput__content-textarea"
|
|
29
|
+
:class="{
|
|
30
|
+
'input-padding':inputBorder
|
|
31
|
+
}"
|
|
32
|
+
:name="name"
|
|
33
|
+
:value="val"
|
|
34
|
+
:placeholder="placeholder"
|
|
35
|
+
:placeholderStyle="placeholderStyle"
|
|
36
|
+
:disabled="disabled"
|
|
37
|
+
placeholder-class="uni-easyinput__placeholder-class"
|
|
38
|
+
:maxlength="inputMaxlength"
|
|
39
|
+
:focus="focused"
|
|
40
|
+
:autoHeight="autoHeight"
|
|
41
|
+
@input="onInput"
|
|
42
|
+
@blur="onBlur"
|
|
43
|
+
@focus="onFocus"
|
|
44
|
+
@confirm="onConfirm"></textarea>
|
|
45
|
+
<input
|
|
46
|
+
v-else
|
|
47
|
+
:type="type === 'password'?'text':type"
|
|
48
|
+
class="uni-easyinput__content-input"
|
|
49
|
+
:style="{
|
|
50
|
+
'padding-right':type === 'password' ||clearable || prefixIcon?'':'10px',
|
|
51
|
+
'padding-left':prefixIcon?'':'10px'
|
|
52
|
+
}"
|
|
53
|
+
:name="name"
|
|
54
|
+
:value="val"
|
|
55
|
+
:password="!showPassword && type === 'password'"
|
|
56
|
+
:placeholder="placeholder"
|
|
57
|
+
:placeholderStyle="placeholderStyle"
|
|
58
|
+
placeholder-class="uni-easyinput__placeholder-class"
|
|
59
|
+
:disabled="disabled"
|
|
60
|
+
:maxlength="inputMaxlength"
|
|
61
|
+
:focus="focused"
|
|
62
|
+
:confirmType="confirmType"
|
|
63
|
+
@focus="onFocus"
|
|
64
|
+
@blur="onBlur"
|
|
65
|
+
@input="onInput"
|
|
66
|
+
@confirm="onConfirm"
|
|
67
|
+
cursor-spacing="20"
|
|
68
|
+
/>
|
|
69
|
+
<template v-if="type === 'password' && passwordIcon" >
|
|
70
|
+
<view class="content-clear-icon" :class="{'is-textarea-icon':type==='textarea'}">
|
|
71
|
+
<xd-font-icon
|
|
72
|
+
color="#c0c4cc"
|
|
73
|
+
size="40"
|
|
74
|
+
v-if="val !== '' "
|
|
75
|
+
:icon="showPassword?'iconchakan':'iconbiyan'"
|
|
76
|
+
@click="onEyes"
|
|
77
|
+
></xd-font-icon>
|
|
78
|
+
</view>
|
|
79
|
+
</template>
|
|
80
|
+
<slot name="right"></slot>
|
|
81
|
+
</view>
|
|
82
|
+
</view>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script>
|
|
86
|
+
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
87
|
+
/**
|
|
88
|
+
* Easyinput 输入框
|
|
89
|
+
* @description 此组件可以实现表单的输入与校验,包括 "text" 和 "textarea" 类型。
|
|
90
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=3455
|
|
91
|
+
* @property {String} value 输入内容
|
|
92
|
+
* @property {String } type 输入框的类型(默认text) password/text/textarea/..
|
|
93
|
+
* @value text 文本输入键盘
|
|
94
|
+
* @value textarea 多行文本输入键盘
|
|
95
|
+
* @value password 密码输入键盘
|
|
96
|
+
* @value number 数字输入键盘,注意iOS上app-vue弹出的数字键盘并非9宫格方式
|
|
97
|
+
* @value idcard 身份证输入键盘,信、支付宝、百度、QQ小程序
|
|
98
|
+
* @value digit 带小数点的数字键盘 ,App的nvue页面、微信、支付宝、百度、头条、QQ小程序支持
|
|
99
|
+
* @property {Boolean} clearable 是否显示右侧清空内容的图标控件,点击可清空输入框内容(默认true)
|
|
100
|
+
* @property {Boolean} autoHeight 是否自动增高输入区域,type为textarea时有效(默认true)
|
|
101
|
+
* @property {String } placeholder 输入框的提示文字
|
|
102
|
+
* @property {String } placeholderStyle placeholder的样式(内联样式,字符串),如"color: #ddd"
|
|
103
|
+
* @property {Boolean} focus 是否自动获得焦点(默认false)
|
|
104
|
+
* @property {Boolean} disabled 是否禁用(默认false)
|
|
105
|
+
* @property {Number } maxlength 最大输入长度,设置为 -1 的时候不限制最大长度(默认140)
|
|
106
|
+
* @property {String } confirmType 设置键盘右下角按钮的文字,仅在type="text"时生效(默认done)
|
|
107
|
+
* @property {Number } clearSize 清除图标的大小,单位px(默认15)
|
|
108
|
+
* @property {String} prefixIcon 输入框头部图标
|
|
109
|
+
* @property {String} suffixIcon 输入框尾部图标
|
|
110
|
+
* @property {Boolean} trim 是否自动去除两端的空格
|
|
111
|
+
* @value both 去除两端空格
|
|
112
|
+
* @value left 去除左侧空格
|
|
113
|
+
* @value right 去除右侧空格
|
|
114
|
+
* @value start 去除左侧空格
|
|
115
|
+
* @value end 去除右侧空格
|
|
116
|
+
* @value all 去除全部空格
|
|
117
|
+
* @value none 不去除空格
|
|
118
|
+
* @property {Boolean} inputBorder 是否显示input输入框的边框(默认true)
|
|
119
|
+
* @property {Boolean} passwordIcon type=password时是否显示小眼睛图标
|
|
120
|
+
* @property {Object} styles 自定义颜色
|
|
121
|
+
* @event {Function} input 输入框内容发生变化时触发
|
|
122
|
+
* @event {Function} focus 输入框获得焦点时触发
|
|
123
|
+
* @event {Function} blur 输入框失去焦点时触发
|
|
124
|
+
* @event {Function} confirm 点击完成按钮时触发
|
|
125
|
+
* @event {Function} iconClick 点击图标时触发
|
|
126
|
+
* @example <uni-easyinput v-model="mobile"></uni-easyinput>
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
export default {
|
|
130
|
+
name: 'XdFormInput',
|
|
131
|
+
components: {XdFontIcon},
|
|
132
|
+
emits:['click','iconClick','update:modelValue','input','focus','blur','confirm'],
|
|
133
|
+
model:{
|
|
134
|
+
prop:'modelValue',
|
|
135
|
+
event:'update:modelValue'
|
|
136
|
+
},
|
|
137
|
+
props: {
|
|
138
|
+
name: String,
|
|
139
|
+
value: [Number, String],
|
|
140
|
+
modelValue: [Number, String],
|
|
141
|
+
type: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: 'text'
|
|
144
|
+
},
|
|
145
|
+
clearable: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
default: true
|
|
148
|
+
},
|
|
149
|
+
autoHeight: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
default: false
|
|
152
|
+
},
|
|
153
|
+
placeholder: String,
|
|
154
|
+
placeholderStyle: String,
|
|
155
|
+
focus: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
default: false
|
|
158
|
+
},
|
|
159
|
+
disabled: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
default: false
|
|
162
|
+
},
|
|
163
|
+
maxlength: {
|
|
164
|
+
type: [Number, String],
|
|
165
|
+
default: 140
|
|
166
|
+
},
|
|
167
|
+
confirmType: {
|
|
168
|
+
type: String,
|
|
169
|
+
default: 'done'
|
|
170
|
+
},
|
|
171
|
+
clearSize: {
|
|
172
|
+
type: [Number, String],
|
|
173
|
+
default: 15
|
|
174
|
+
},
|
|
175
|
+
inputBorder: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: false
|
|
178
|
+
},
|
|
179
|
+
prefixIcon: {
|
|
180
|
+
type: String,
|
|
181
|
+
default: ''
|
|
182
|
+
},
|
|
183
|
+
suffixIcon: {
|
|
184
|
+
type: String,
|
|
185
|
+
default: ''
|
|
186
|
+
},
|
|
187
|
+
trim: {
|
|
188
|
+
type: [Boolean, String],
|
|
189
|
+
default: true
|
|
190
|
+
},
|
|
191
|
+
passwordIcon:{
|
|
192
|
+
type: Boolean,
|
|
193
|
+
default: true
|
|
194
|
+
},
|
|
195
|
+
styles: {
|
|
196
|
+
type: Object,
|
|
197
|
+
default () {
|
|
198
|
+
return {
|
|
199
|
+
color: '#333',
|
|
200
|
+
disableColor: '#F7F6F6',
|
|
201
|
+
borderColor: '#e5e5e5'
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
errorMessage:{
|
|
206
|
+
type:[String,Boolean],
|
|
207
|
+
default:''
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
data() {
|
|
211
|
+
return {
|
|
212
|
+
focused: false,
|
|
213
|
+
errMsg: '',
|
|
214
|
+
val: '',
|
|
215
|
+
showMsg: '',
|
|
216
|
+
border: false,
|
|
217
|
+
isFirstBorder: false,
|
|
218
|
+
showClearIcon: false,
|
|
219
|
+
showPassword: false,
|
|
220
|
+
contentAlign: '',
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
computed: {
|
|
224
|
+
msg() {
|
|
225
|
+
return this.errorMessage || this.errMsg;
|
|
226
|
+
},
|
|
227
|
+
// 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
|
|
228
|
+
inputMaxlength() {
|
|
229
|
+
return Number(this.maxlength);
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
watch: {
|
|
233
|
+
value(newVal) {
|
|
234
|
+
if (this.errMsg) this.errMsg = ''
|
|
235
|
+
this.val = newVal
|
|
236
|
+
// fix by mehaotian is_reset 在 uni-forms 中定义
|
|
237
|
+
if (this.form && this.formItem &&!this.is_reset) {
|
|
238
|
+
this.is_reset = false
|
|
239
|
+
this.formItem.setValue(newVal)
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
modelValue(newVal) {
|
|
243
|
+
if (this.errMsg) this.errMsg = ''
|
|
244
|
+
this.val = newVal
|
|
245
|
+
if (this.form && this.formItem &&!this.is_reset) {
|
|
246
|
+
this.is_reset = false
|
|
247
|
+
this.formItem.setValue(newVal)
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
focus(newVal) {
|
|
251
|
+
this.$nextTick(() => {
|
|
252
|
+
console.log('focus',newVal)
|
|
253
|
+
this.focused = this.focus
|
|
254
|
+
})
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
created() {
|
|
258
|
+
if(!this.value){
|
|
259
|
+
this.val = this.modelValue
|
|
260
|
+
}
|
|
261
|
+
if(!this.modelValue){
|
|
262
|
+
this.val = this.value
|
|
263
|
+
}
|
|
264
|
+
this.form = this.getForm('XdForm')
|
|
265
|
+
this.formItem = this.getForm('XdFormItem');
|
|
266
|
+
this.contentAlign = this.formItem.contentAlign;
|
|
267
|
+
let {contentAlign} = this.formItem;
|
|
268
|
+
|
|
269
|
+
if (this.form && this.formItem) {
|
|
270
|
+
if (this.formItem.name) {
|
|
271
|
+
if(!this.is_reset){
|
|
272
|
+
this.is_reset = false
|
|
273
|
+
this.formItem.setValue(this.val)
|
|
274
|
+
}
|
|
275
|
+
this.rename = this.formItem.name
|
|
276
|
+
this.form.inputChildrens.push(this)
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
mounted() {
|
|
281
|
+
this.contentAlign = this.formItem.contentAlign;
|
|
282
|
+
let {contentAlign} = this.formItem;
|
|
283
|
+
console.log('this.contentAlign',contentAlign);
|
|
284
|
+
this.$nextTick(() => {
|
|
285
|
+
this.focused = this.focus
|
|
286
|
+
})
|
|
287
|
+
},
|
|
288
|
+
methods: {
|
|
289
|
+
/**
|
|
290
|
+
* 初始化变量值
|
|
291
|
+
*/
|
|
292
|
+
init() {
|
|
293
|
+
|
|
294
|
+
},
|
|
295
|
+
onClickIcon(type) {
|
|
296
|
+
this.$emit('iconClick', type)
|
|
297
|
+
},
|
|
298
|
+
/**
|
|
299
|
+
* 获取父元素实例
|
|
300
|
+
*/
|
|
301
|
+
getForm(name = 'xdForm') {
|
|
302
|
+
let parent = this.$parent;
|
|
303
|
+
let parentName = parent.$options.name;
|
|
304
|
+
while (parentName !== name) {
|
|
305
|
+
parent = parent.$parent;
|
|
306
|
+
if (!parent) return false;
|
|
307
|
+
parentName = parent.$options.name;
|
|
308
|
+
}
|
|
309
|
+
return parent;
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
onEyes() {
|
|
313
|
+
this.showPassword = !this.showPassword
|
|
314
|
+
},
|
|
315
|
+
onInput(event) {
|
|
316
|
+
let value = event.detail.value;
|
|
317
|
+
// 判断是否去除空格
|
|
318
|
+
if (this.trim) {
|
|
319
|
+
if (typeof(this.trim) === 'boolean' && this.trim) {
|
|
320
|
+
value = this.trimStr(value)
|
|
321
|
+
}
|
|
322
|
+
if (typeof(this.trim) === 'string') {
|
|
323
|
+
value = this.trimStr(value, this.trim)
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
if (this.errMsg) this.errMsg = ''
|
|
327
|
+
this.val = value
|
|
328
|
+
// TODO 兼容 vue2
|
|
329
|
+
this.$emit('input', value);
|
|
330
|
+
// TODO 兼容 vue3
|
|
331
|
+
this.$emit('update:modelValue',value)
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
onFocus(event) {
|
|
335
|
+
this.$emit('focus', event);
|
|
336
|
+
},
|
|
337
|
+
onBlur(event) {
|
|
338
|
+
let value = event.detail.value;
|
|
339
|
+
this.$emit('blur', event);
|
|
340
|
+
},
|
|
341
|
+
onConfirm(e) {
|
|
342
|
+
this.$emit('confirm', e.detail.value);
|
|
343
|
+
},
|
|
344
|
+
onClear(event) {
|
|
345
|
+
this.val = '';
|
|
346
|
+
// TODO 兼容 vue2
|
|
347
|
+
this.$emit('input', '');
|
|
348
|
+
// TODO 兼容 vue2
|
|
349
|
+
// TODO 兼容 vue3
|
|
350
|
+
this.$emit('update:modelValue','')
|
|
351
|
+
},
|
|
352
|
+
fieldClick() {
|
|
353
|
+
this.$emit('click');
|
|
354
|
+
},
|
|
355
|
+
trimStr(str, pos = 'both') {
|
|
356
|
+
if (pos === 'both') {
|
|
357
|
+
return str.trim();
|
|
358
|
+
} else if (pos === 'left') {
|
|
359
|
+
return str.trimLeft();
|
|
360
|
+
} else if (pos === 'right') {
|
|
361
|
+
return str.trimRight();
|
|
362
|
+
} else if (pos === 'start') {
|
|
363
|
+
return str.trimStart()
|
|
364
|
+
} else if (pos === 'end') {
|
|
365
|
+
return str.trimEnd()
|
|
366
|
+
} else if (pos === 'all') {
|
|
367
|
+
return str.replace(/\s+/g, '');
|
|
368
|
+
} else if (pos === 'none') {
|
|
369
|
+
return str;
|
|
370
|
+
}
|
|
371
|
+
return str;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
</script>
|
|
376
|
+
|
|
377
|
+
<style lang="less">
|
|
378
|
+
@uni-error: #e43d33;
|
|
379
|
+
@uni-border-1: #ccc;
|
|
380
|
+
.uni-easyinput {
|
|
381
|
+
/* #ifndef APP-NVUE */
|
|
382
|
+
width: 100%;
|
|
383
|
+
/* #endif */
|
|
384
|
+
flex: 1;
|
|
385
|
+
position: relative;
|
|
386
|
+
text-align: left;
|
|
387
|
+
color: #333;
|
|
388
|
+
font-size: unit(28,rpx);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.uni-easyinput__content {
|
|
392
|
+
flex: 1;
|
|
393
|
+
/* #ifndef APP-NVUE */
|
|
394
|
+
width: 100%;
|
|
395
|
+
display: flex;
|
|
396
|
+
box-sizing: border-box;
|
|
397
|
+
min-height: unit(72, rpx);
|
|
398
|
+
/* #endif */
|
|
399
|
+
flex-direction: row;
|
|
400
|
+
align-items: center;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.uni-easyinput__content-input {
|
|
404
|
+
/* #ifndef APP-NVUE */
|
|
405
|
+
width: auto;
|
|
406
|
+
/* #endif */
|
|
407
|
+
position: relative;
|
|
408
|
+
overflow: hidden;
|
|
409
|
+
flex: 1;
|
|
410
|
+
line-height: 1;
|
|
411
|
+
font-size: unit(30, rpx);
|
|
412
|
+
color: #979797;
|
|
413
|
+
}
|
|
414
|
+
/deep/ .uni-easyinput__placeholder-class {
|
|
415
|
+
color: #979797;
|
|
416
|
+
font-size: unit(30, rpx);
|
|
417
|
+
font-weight: 200;
|
|
418
|
+
}
|
|
419
|
+
.is-textarea {
|
|
420
|
+
align-items: flex-start;
|
|
421
|
+
background: #F5F5F5;
|
|
422
|
+
border: 1px solid #CDCDCD;
|
|
423
|
+
border-radius: unit(10, rpx);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.is-textarea-icon {
|
|
427
|
+
margin-top: unit(10, rpx);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.uni-easyinput__content-textarea {
|
|
431
|
+
position: relative;
|
|
432
|
+
width: 100%;
|
|
433
|
+
overflow: hidden;
|
|
434
|
+
color: #979797;
|
|
435
|
+
font-size: unit(30, rpx);
|
|
436
|
+
font-weight: normal;
|
|
437
|
+
text-align: left;
|
|
438
|
+
flex: 1;
|
|
439
|
+
background: #F5F5F5;
|
|
440
|
+
line-height: 1.5;
|
|
441
|
+
padding: unit(12, rpx) unit(12, rpx) unit(20, rpx);
|
|
442
|
+
height: unit(160, rpx);
|
|
443
|
+
box-sizing: border-box;
|
|
444
|
+
/* #ifndef APP-NVUE */
|
|
445
|
+
min-height: unit(160, rpx);
|
|
446
|
+
/* #endif */
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.input-padding {
|
|
450
|
+
padding-left: unit(20, rpx);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.content-clear-icon {
|
|
454
|
+
padding: 0 0 0 unit(20, rpx);
|
|
455
|
+
width: unit(40, rpx);
|
|
456
|
+
height: unit(40, rpx);
|
|
457
|
+
}
|
|
458
|
+
.content-right-icon {
|
|
459
|
+
padding: 0 0 0 unit(20, rpx);
|
|
460
|
+
width: unit(40, rpx);
|
|
461
|
+
height: unit(40, rpx);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.label-icon {
|
|
465
|
+
margin-right: unit(10, rpx);
|
|
466
|
+
margin-top: unit(-2, rpx);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// 显示边框
|
|
470
|
+
.is-input-border {
|
|
471
|
+
/* #ifndef APP-NVUE */
|
|
472
|
+
display: flex;
|
|
473
|
+
box-sizing: border-box;
|
|
474
|
+
/* #endif */
|
|
475
|
+
flex-direction: row;
|
|
476
|
+
align-items: center;
|
|
477
|
+
border: 1px solid @uni-border-1;
|
|
478
|
+
border-radius: unit(8, rpx);
|
|
479
|
+
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.uni-error-message {
|
|
483
|
+
position: absolute;
|
|
484
|
+
bottom: -17px;
|
|
485
|
+
left: 0;
|
|
486
|
+
line-height: unit(24, rpx);
|
|
487
|
+
color: @uni-error;
|
|
488
|
+
font-size: unit(24, rpx);
|
|
489
|
+
text-align: left;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.uni-error-msg--boeder {
|
|
493
|
+
position: relative;
|
|
494
|
+
bottom: 0;
|
|
495
|
+
line-height: unit(44, rpx);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.is-input-error-border {
|
|
499
|
+
border-color: @uni-error;
|
|
500
|
+
.uni-easyinput__placeholder-class {
|
|
501
|
+
color: mix(#fff, @uni-error, 50%);;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
.uni-easyinput--border {
|
|
507
|
+
margin-bottom: 0;
|
|
508
|
+
padding: unit(20, rpx) unit(30, rpx);
|
|
509
|
+
// padding-bottom: 0;
|
|
510
|
+
border-top: 1px #eee solid;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.uni-easyinput-error {
|
|
514
|
+
padding-bottom: 0;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.is-first-border {
|
|
518
|
+
/* #ifndef APP-NVUE */
|
|
519
|
+
border: none;
|
|
520
|
+
/* #endif */
|
|
521
|
+
/* #ifdef APP-NVUE */
|
|
522
|
+
border-width: 0;
|
|
523
|
+
/* #endif */
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.is-disabled {
|
|
527
|
+
border-color: red;
|
|
528
|
+
background-color: #F7F6F6;
|
|
529
|
+
color: #D5D5D5;
|
|
530
|
+
.uni-easyinput__placeholder-class {
|
|
531
|
+
color: #D5D5D5;
|
|
532
|
+
font-size: unit(24, rpx);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
</style>
|