|
@@ -4,7 +4,13 @@
|
|
<!-- 轮播图 -->
|
|
<!-- 轮播图 -->
|
|
<!-- <swiper /> -->
|
|
<!-- <swiper /> -->
|
|
<!-- 用户做题预选界面 -->
|
|
<!-- 用户做题预选界面 -->
|
|
- <van-tabs class="car-type" line-width="0" animated>
|
|
|
|
|
|
+ <van-tabs
|
|
|
|
+ class="car-type"
|
|
|
|
+ line-width="0"
|
|
|
|
+ animated
|
|
|
|
+ ref="carTypeRef"
|
|
|
|
+ @click="carTypeChange"
|
|
|
|
+ >
|
|
<van-tab
|
|
<van-tab
|
|
v-for="(carTypeItem, index) in carTypeList"
|
|
v-for="(carTypeItem, index) in carTypeList"
|
|
:key="index"
|
|
:key="index"
|
|
@@ -39,20 +45,16 @@ import sujectOne from "./components/sujectOne.vue";
|
|
import userData from "./components/userData.vue";
|
|
import userData from "./components/userData.vue";
|
|
import { ref, nextTick, onBeforeMount } from "vue";
|
|
import { ref, nextTick, onBeforeMount } from "vue";
|
|
import { useStore } from "vuex";
|
|
import { useStore } from "vuex";
|
|
-// const store = useStore();
|
|
|
|
|
|
+const store = useStore();
|
|
|
|
|
|
-// const carTypeRef = ref<any>(null);
|
|
|
|
-// onBeforeMount(() => {
|
|
|
|
-// nextTick(() => {
|
|
|
|
-// try {
|
|
|
|
-// carTypeRef.value.scrollTo(store.state.carType);
|
|
|
|
-// } catch (error) {}
|
|
|
|
-// });
|
|
|
|
-// });
|
|
|
|
|
|
+const carTypeRef = ref<any>(null);
|
|
|
|
+nextTick(() => {
|
|
|
|
+ carTypeRef.value.scrollTo(store.state.carType);
|
|
|
|
+});
|
|
|
|
|
|
-// const carTypeChange = (e: string) => {
|
|
|
|
-// store.commit("setCatType", e);
|
|
|
|
-// };
|
|
|
|
|
|
+const carTypeChange = (e: string) => {
|
|
|
|
+ store.commit("setCatType", e);
|
|
|
|
+};
|
|
|
|
|
|
const carTypeList = ref([
|
|
const carTypeList = ref([
|
|
{
|
|
{
|