wyling007 пре 3 година
родитељ
комит
68e4c071b2
3 измењених фајлова са 23 додато и 21 уклоњено
  1. 7 7
      package-lock.json
  2. 1 1
      package.json
  3. 15 13
      src/views/home/children/test/index.vue

+ 7 - 7
package-lock.json

@@ -321,11 +321,11 @@
       "dev": true
     },
     "axios": {
-      "version": "0.21.1",
-      "resolved": "https://registry.npm.taobao.org/axios/download/axios-0.21.1.tgz?cache=0&sync_timestamp=1608609215811&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Faxios%2Fdownload%2Faxios-0.21.1.tgz",
-      "integrity": "sha1-IlY0gZYvTWvemnbVFu8OXTwJsrg=",
+      "version": "0.21.4",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
+      "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
       "requires": {
-        "follow-redirects": "^1.10.0"
+        "follow-redirects": "^1.14.0"
       }
     },
     "babel-walk": {
@@ -551,9 +551,9 @@
       }
     },
     "follow-redirects": {
-      "version": "1.14.1",
-      "resolved": "https://registry.nlark.com/follow-redirects/download/follow-redirects-1.14.1.tgz?cache=0&sync_timestamp=1620555292056&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.14.1.tgz",
-      "integrity": "sha1-2RFN7Qoc/dM04WTmZirQK/2R/0M="
+      "version": "1.14.6",
+      "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz",
+      "integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A=="
     },
     "fsevents": {
       "version": "2.3.2",

+ 1 - 1
package.json

@@ -8,7 +8,7 @@
     "serve": "vite preview"
   },
   "dependencies": {
-    "axios": "^0.21.1",
+    "axios": "^0.21.4",
     "dayjs": "^1.10.7",
     "howler": "^2.2.3",
     "marked": "^3.0.4",

+ 15 - 13
src/views/home/children/test/index.vue

@@ -4,7 +4,13 @@
   <!-- 轮播图 -->
   <!-- <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
       v-for="(carTypeItem, index) in carTypeList"
       :key="index"
@@ -39,20 +45,16 @@ import sujectOne from "./components/sujectOne.vue";
 import userData from "./components/userData.vue";
 import { ref, nextTick, onBeforeMount } from "vue";
 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([
   {