随笔分类 -  vue商城项目

摘要:data(){ return{ searchParams : { "category1Id": "", "category2Id": "", "category3Id": "", "categoryName": "", "keyword": "", "order": "", "pageNo": 1, 阅读全文
posted @ 2023-08-10 00:30 sgj191024 阅读(23) 评论(0) 推荐(0) 编辑
摘要:这里使用的是swiper5 npm install swiper@5 main.js引入 import "swiper/css/swiper.min.css" 页面用 import Swiper from "swiper"; <div class="swiper-container" id="myS 阅读全文
posted @ 2023-08-06 22:41 sgj191024 阅读(47) 评论(0) 推荐(0) 编辑
摘要:点击三级分类跳转的时候带上了query参数,然后再次点击关键字搜索,需要把keyword和原来的参数合并 console.log("qury",this.$route.query); let query = JSON.parse(JSON.stringify(this.$route.query)) 阅读全文
posted @ 2023-08-05 23:35 sgj191024 阅读(20) 评论(0) 推荐(0) 编辑
摘要:要过度的元素需要有v-if或者v-show,用transition包裹 <transition name="sort"> <div class="sort" v-show="show"> <div class="all-sort-list2" @click="goSearch"> <div clas 阅读全文
posted @ 2023-08-05 22:13 sgj191024 阅读(3) 评论(0) 推荐(0) 编辑
摘要:1、因为一级,二级,三级分类都是a标签for循环出来的,如果我们直接给他加点击事件,假设循环了1000个a标签,就会有1000个点击事件,这回非常损耗性能,如果利用事件委派去做,就只用一次 自定义属性 <a href="#" :data-categoryname="c1.categoryName"> 阅读全文
posted @ 2023-08-04 01:21 sgj191024 阅读(16) 评论(0) 推荐(0) 编辑
摘要:import _ from "lodash" // 节流 // change:_.throttle(function(){ // console.log(123); // },1000) // 防抖 change:_.debounce(function(){ console.log(123); }, 阅读全文
posted @ 2023-08-03 01:18 sgj191024 阅读(61) 评论(0) 推荐(0) 编辑
摘要:mouse over时 this.currentIndex = index,给item项加动态样式 :class="{ cur : currentIndex==index}" .cur{ background-color: skyblue; } 方式一: 在二级分类的平级 &表示二级分类的上一级 & 阅读全文
posted @ 2023-08-03 01:17 sgj191024 阅读(263) 评论(0) 推荐(0) 编辑
摘要:import Vue from 'vue'; import Vuex from 'vuex'; Vue.use(Vuex); import home from "./home" import search from "./search" const store = new Vuex.Store({ 阅读全文
posted @ 2023-08-01 23:20 sgj191024 阅读(30) 评论(0) 推荐(0) 编辑
摘要:import axios from "axios" import nprogress from "nprogress" import "nprogress/nprogress.css" const requests = axios.create({ baseURL : "/api", timeout 阅读全文
posted @ 2023-07-28 00:36 sgj191024 阅读(5) 评论(0) 推荐(0) 编辑
摘要:import requests from "./requests" export const categoryList = () =>{ return requests({ url:"/product/getBaseCategoryList", method : "get" }) } import 阅读全文
posted @ 2023-07-28 00:35 sgj191024 阅读(103) 评论(0) 推荐(0) 编辑
摘要:import axios from "axios" const requests = axios.create({ baseURL : "/api", timeout : 5000 }) requests.interceptors.request.use((config) =>{ return co 阅读全文
posted @ 2023-07-27 23:55 sgj191024 阅读(8) 评论(0) 推荐(0) 编辑
摘要:在router中重写push VueRouter.prototype.push = function(location,resolve,reject){ if(resolve && reject){ orginPush.call(this,location, resolve,reject) }els 阅读全文
posted @ 2023-07-26 22:39 sgj191024 阅读(5) 评论(0) 推荐(0) 编辑
摘要:1.param 给将要跳转到的路由加占位 { path:"/search/:keyword", component:Search, meta:{ show:true } }, goSearch(){ this.$router.push("/search/" + this.keyword) } 2.q 阅读全文
posted @ 2023-07-26 21:36 sgj191024 阅读(25) 评论(0) 推荐(0) 编辑
摘要:routes:[ { path:"/home", component:Home, meta:{ show:true } }, { path:"/login", component:Login, meta:{ show:false } }, { path:"/register", component: 阅读全文
posted @ 2023-07-26 20:41 sgj191024 阅读(34) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示