<template>
  <view class="asset_houses">
    <!-- <hs-empty v-if="!useModel?.dataList?.value?.length" /> -->
    <cc-scroll-loading :meta="useModel?.metaData?.value" @load="method?.handleLoadMore">
      <view class="asset_houses_card" v-for="(i, index) in useModel?.dataList?.value" :key="`item_${index}`">
        <view class="card_header" @click="method?.handleSelectedProject(i)">
          <view class="asset_houses_name">
            <view>
              <view class="name">
                {{ i?.name }}
              </view>
              <view class="address"> {{ i?.province }}/{{ i?.city }}/{{ i?.area }} </view>
            </view>
            <uni-icons v-if="i?.id === useModel.selectedHouseEd.value?.id" type="checkbox-filled" size="20"
              color="#2A7EFB"></uni-icons>
            <uni-icons v-else type="circle" size="20" color="#999"></uni-icons>
          </view>
        </view>
      </view>
    </cc-scroll-loading>
  </view>
</template>
<script setup lang="ts">
import { onLoad, onUnload } from '@dcloudio/uni-app'
import method from './method'
import useModel from './model'

onUnload(() => {
  useModel.formData.value.page = 1
  useModel.dataList.value = []
})

onLoad((e: any) => {
  useModel.dataList.value = []
  useModel.source.value = e?.source || ''
  // source=emergency_add
  method?.handleLoadMore({ page: 1 })
})
</script>
<style lang="scss">
@import './style.scss';
</style>
