|
@@ -1,7 +1,12 @@
|
|
|
<template>
|
|
|
<div class="antiquity">
|
|
|
<div class="antiquity-search">
|
|
|
- <input v-model="keyword" type="search" placeholder="请输入文物名称" />
|
|
|
+ <input
|
|
|
+ v-model="keyword"
|
|
|
+ ref="search"
|
|
|
+ type="search"
|
|
|
+ placeholder="请输入文物名称"
|
|
|
+ />
|
|
|
<img src="@/assets/images/search-min.png" />
|
|
|
</div>
|
|
|
|
|
@@ -14,11 +19,20 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, computed } from "vue";
|
|
|
+import { ref, computed, onMounted } from "vue";
|
|
|
import { antiquityData } from "@lbc/base";
|
|
|
import List from "./components/List.vue";
|
|
|
+import { useRoute } from "vue-router";
|
|
|
|
|
|
const keyword = ref("");
|
|
|
+const route = useRoute();
|
|
|
+const search = ref();
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ if (route.query.focus) {
|
|
|
+ search.value.focus();
|
|
|
+ }
|
|
|
+});
|
|
|
|
|
|
const tabs = computed(() => {
|
|
|
const regex = new RegExp(keyword.value, "i");
|