<template>
  <view class="switch_select_house">
    <picker @change="bindPickerChange" :range="useModel?.listData?.value" range-key="full_name">
      <view class="switch_select_btn">
        切换通行证
        <image src="/static/svg/switch_select_house.svg" mode="widthFix" />
      </view>
    </picker>
  </view>
</template>
<script setup lang="ts">
import method from '../method'
import useModel from '../model'
const bindPickerChange = (e: any) => {
  let data = useModel?.listData?.value[e.detail.value] || {}
  console.log(data, 'data')
  useModel.currentHouse.value = data
  method?.getQrCode()
}
</script>
<style lang="scss" scoped>
.switch_select_house {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 30rpx;
}
.switch_select_btn {
  background-color: #f7f7f7;
  color: #333;
  font-size: 28rpx;
  padding: 20rpx 30rpx;
  border-radius: 100rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  image {
    width: 24rpx;
    height: 16rpx;
    margin-left: 5rpx;
  }
}
</style>
