<template>
	<view>
		<u-input v-model="dataValue" 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.settings || []
				result = settings.map(item => {
					return {
						text: item
					}
				})
				return result
			}
		},
		watch: {},
		mounted() {},
		methods: {
			actionSheetCallback(index) {
				let txt = this.settings[index].text;
				this.dataValue = txt
				this.valueChange(txt)
			}
		}
	}
</script>

<style>
</style>
