|
@@ -21,7 +21,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
<view class="uni-combox__selector-item" v-for="(item, index) in filterCandidates" :key="index"
|
|
<view class="uni-combox__selector-item" v-for="(item, index) in filterCandidates" :key="index"
|
|
|
@click="onSelectorClick(index)">
|
|
@click="onSelectorClick(index)">
|
|
|
- <text>{{ item }}</text>
|
|
|
|
|
|
|
+ <text :class="{ 'uni-combox__selector__disabled': options[index].disable }">{{ item }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
</scroll-view>
|
|
</scroll-view>
|
|
|
</view>
|
|
</view>
|
|
@@ -36,7 +36,8 @@
|
|
|
* @property {String} label 左侧文字
|
|
* @property {String} label 左侧文字
|
|
|
* @property {String} labelWidth 左侧内容宽度
|
|
* @property {String} labelWidth 左侧内容宽度
|
|
|
* @property {String} placeholder 输入框占位符
|
|
* @property {String} placeholder 输入框占位符
|
|
|
- * @property {Array} candidates 候选项列表
|
|
|
|
|
|
|
+ * @property {Array} candidates 候选项列表(只有text,展示用)
|
|
|
|
|
+ * @property {Array} options 候选项列表全部内容,
|
|
|
* @property {String} emptyTips 筛选结果为空时显示的文字
|
|
* @property {String} emptyTips 筛选结果为空时显示的文字
|
|
|
* @property {String} value 组合框的值
|
|
* @property {String} value 组合框的值
|
|
|
*/
|
|
*/
|
|
@@ -52,6 +53,10 @@ export default {
|
|
|
type: Boolean,
|
|
type: Boolean,
|
|
|
default: true
|
|
default: true
|
|
|
},
|
|
},
|
|
|
|
|
+ disabled: {
|
|
|
|
|
+ type: Boolean,
|
|
|
|
|
+ default: false
|
|
|
|
|
+ },
|
|
|
label: {
|
|
label: {
|
|
|
type: String,
|
|
type: String,
|
|
|
default: ''
|
|
default: ''
|
|
@@ -70,6 +75,12 @@ export default {
|
|
|
return []
|
|
return []
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ options: {
|
|
|
|
|
+ type: Array,
|
|
|
|
|
+ default() {
|
|
|
|
|
+ return []
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
emptyTips: {
|
|
emptyTips: {
|
|
|
type: String,
|
|
type: String,
|
|
|
default: '无匹配项'
|
|
default: '无匹配项'
|
|
@@ -140,10 +151,16 @@ export default {
|
|
|
}, 153)
|
|
}, 153)
|
|
|
},
|
|
},
|
|
|
onSelectorClick(index) {
|
|
onSelectorClick(index) {
|
|
|
- this.inputVal = this.filterCandidates[index]
|
|
|
|
|
- this.showSelector = false
|
|
|
|
|
- this.$emit('input', this.inputVal)
|
|
|
|
|
- this.$emit('update:modelValue', this.inputVal)
|
|
|
|
|
|
|
+ // 添加disable判断,如果没有传入原来的值
|
|
|
|
|
+ const item = this.options[index]||{}
|
|
|
|
|
+
|
|
|
|
|
+ // console.log(item,'comboxitem')
|
|
|
|
|
+ if (!item.disable){
|
|
|
|
|
+ this.inputVal = this.filterCandidates[index]
|
|
|
|
|
+ this.showSelector = false
|
|
|
|
|
+ this.$emit('input', this.inputVal)
|
|
|
|
|
+ this.$emit('update:modelValue', this.inputVal)
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
onInput() {
|
|
onInput() {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -227,6 +244,11 @@ export default {
|
|
|
/* #endif */
|
|
/* #endif */
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+.uni-combox__selector__disabled{
|
|
|
|
|
+ opacity: 0.4;
|
|
|
|
|
+ cursor: default;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
.uni-combox__selector-empty,
|
|
.uni-combox__selector-empty,
|
|
|
.uni-combox__selector-item {
|
|
.uni-combox__selector-item {
|
|
|
/* #ifndef APP-NVUE */
|
|
/* #ifndef APP-NVUE */
|