<template>
	<view>
		<picker
			v-if="bankList.length > 0"
			:range="bankList"
			range-key="title"
			:value="bankValue"
			@change="bindPickerChange"
		>
			<view class="uni-input">{{bankList[bankIndex].title}}</view>
		</picker>
	</view>
</template>

<script>
	export default {
		name: 'mouldPicker',
		props: {
			bankList: {
				type: Array,
				default: () => {
					return []
				}
			},
			bankValue: {
				type: Number,
				default: () => {
					return []
				}
			}
		},
		data(){
			return {
				bankIndex: 0
			}
		},
		watch:{
			bankList(e, old){
				this.bankIndex = 0;
			}
		},
		onLoad() {
		},
		methods: {
			bindPickerChange(e){
				this.bankIndex = e.detail.value
				this.$emit('bankPicker', this.bankList[e.detail.value].institution_id)
			}
		}
	}
</script>

<style>
	
</style>
