1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!-- ******************* 单个下拉选择 ******************* -->
<template>
<view>
<u-input :value="text" readOnly @click="show=true" type="select" />
<u-action-sheet :list="settings" v-model="show" @click="actionSheetCallback"></u-action-sheet>
</view>
</template>
<script>
import stringMixin from './stringMixin'
export default {
name: 'XhSelect',
components: {},
mixins: [stringMixin],
props: {},
data() {
return {
show: false
}
},
computed: {
type() {
if (this.item && this.item.fieldsType == 'password') {
return this.item.fieldsType
} else {
return 'text'
}
},
settings() {
let result = []
let settings = this.item.fieldsOptions || []
result = settings.map(item => {
return {
text: item.label,
id: item.key
}
})
return result
},
text(){
let option = this.item.fieldsOptions.find(a=>{return a.key === this.dataValue})
return option?option.label:''
}
},
watch: {},
mounted() {},
methods: {
actionSheetCallback(index) {
let id = this.settings[index].id;
this.dataValue = id
this.valueChange(id)
}
}
}
</script>
<style>
</style>