|
|
@@ -75,7 +75,10 @@ const getCol = () => {
|
|
|
return valIndex.value.length > 0 ? columnList.value[valIndex.value[0]] : columnList.value[0]
|
|
|
}
|
|
|
const getVal = () => {
|
|
|
- return getCol()[props.map.value]
|
|
|
+ if (getCol()) {
|
|
|
+ return getCol()[props.map.value]
|
|
|
+ }
|
|
|
+ return ""
|
|
|
}
|
|
|
|
|
|
const changeValue = () => {
|
|
|
@@ -111,6 +114,10 @@ function hidePopup(type?: "confirm" | "cancel" | "maskClick") {
|
|
|
}
|
|
|
|
|
|
function bindShowPopup() {
|
|
|
+ uni.hideKeyboard()
|
|
|
+ if (props.disabled) {
|
|
|
+ return
|
|
|
+ }
|
|
|
showPopup()
|
|
|
}
|
|
|
function bindClear() {
|
|
|
@@ -172,16 +179,17 @@ function init() {
|
|
|
onLoad(init)
|
|
|
</script>
|
|
|
<template>
|
|
|
- <view class="is-link">
|
|
|
- <uni-easyinput
|
|
|
- type="text"
|
|
|
- v-model="valText"
|
|
|
- @focus="bindShowPopup"
|
|
|
- @clear="bindClear"
|
|
|
- :inputBorder="false"
|
|
|
- :placeholder="_placeholder"
|
|
|
- :disabled="disabled"
|
|
|
- />
|
|
|
+ <view class="vb-picker" @click="bindShowPopup" :class="{ 'is-disabled': disabled }">
|
|
|
+ <view class="vb-picker__content">
|
|
|
+ <view class="vb-picker__text" v-if="valText">{{ valText }}</view>
|
|
|
+ <view class="vb-picker__placeholder" v-else-if="placeholder">{{ placeholder }}</view>
|
|
|
+ <i
|
|
|
+ v-if="valText && !disabled"
|
|
|
+ class="vb-picker__icon-clera"
|
|
|
+ :style="{ color: show ? 'var(--vb-color)' : '#c0c4cc' }"
|
|
|
+ @click.stop="bindClear"
|
|
|
+ ></i>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view ref="popupRef" class="vb-popup" v-if="show">
|
|
|
<view class="vb-popup-content">
|
|
|
@@ -207,3 +215,5 @@ onLoad(init)
|
|
|
<view class="vb-popup__mask" @click="bindMaskClick"></view>
|
|
|
</view>
|
|
|
</template>
|
|
|
+
|
|
|
+<style></style>
|