<script setup lang="ts">
import { ref, onMounted } from 'vue';
import Taro from '@tarojs/taro';
import MerList from '@/components/MerList.vue';
import Storelist from '@/components/StoreList.vue';

const classId = ref();

const name = ref('');

onMounted(() => {
  const e = Taro.getCurrentInstance().router?.params as any;
  if (e.id) {
    Taro.setNavigationBarTitle({
      title: e.name,
    });
    classId.value = Number(e.id);
  } else {
    Taro.setNavigationBarTitle({
      title: '搜索列表',
    });
    name.value = e.name;
  }
});
</script>

<template>
  <view>
    <MerList v-if="classId" v-model="classId" />
    <Storelist v-else v-model="name" />
  </view>
</template>

<style lang="scss"></style>
