需改pc样式上的bug

master
lemon橪 2022-02-15 16:54:36 +08:00
parent db13814156
commit 45a6e76d4a
1 changed files with 86 additions and 70 deletions

View File

@ -2,55 +2,71 @@
<div class="scroll-show"> <div class="scroll-show">
<div class="content clearfix"> <div class="content clearfix">
<cateNav class="cate" :hover="true" :showNavBar="false"></cateNav> <cateNav class="cate" :hover="true" :showNavBar="false"></cateNav>
<Search class="search-con" :hover="true" :showLogo="false" :showTag="false"></Search> <Search
<Icon type="ios-cart-outline" @click="goCartList" class="cart-icon" @mouseenter.native="getCartList" /> class="search-con"
<i class="cart-badge">{{cartNum < 100 ? cartNum : '99'}}</i> :hover="true"
:showLogo="false"
:showTag="false"
></Search>
<Icon
type="ios-cart-outline"
@click="goCartList"
class="cart-icon"
@mouseenter.native="getCartList"
/>
<i class="cart-badge">{{ cartNum < 100 ? cartNum : "99" }}</i>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import {cartCount} from '@/api/cart.js' import { cartCount } from "@/api/cart.js";
import storage from '@/plugins/storage.js'; import storage from "@/plugins/storage.js";
export default { export default {
data() { data() {
return { return {
userInfo: {} // userInfo: {}, //
} };
}, },
computed: { computed: {
cartNum () { // cartNum() {
return this.$store.state.cartNum //
} return this.$store.state.cartNum;
},
}, },
methods: { methods: {
goCartList () { // goCartList() {
//
let routerUrl = this.$router.resolve({ let routerUrl = this.$router.resolve({
path: '/cart' path: "/cart",
}) });
window.open(routerUrl.href, '_blank') window.open(routerUrl.href, "_blank");
}, },
getCartList () { // getCartList() {
if (storage.getItem('userInfo')) { //
cartCount().then(res => { if (storage.getItem("userInfo")) {
this.$store.commit('SET_CARTNUM', res.result) cartCount().then((res) => {
this.Cookies.setItem('cartNum', res.result) this.$store.commit("SET_CARTNUM", res.result);
}) this.Cookies.setItem("cartNum", res.result);
} });
} }
}, },
},
mounted() { mounted() {
if (storage.getItem('userInfo')) { if (storage.getItem("userInfo")) {
this.userInfo = JSON.parse(storage.getItem('userInfo')); this.userInfo = JSON.parse(storage.getItem("userInfo"));
}
}
} }
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.content { .content {
width: 1200px; width: 1200px;
height: 40px; height: 100%;
margin: 10px auto; margin: auto;
position: relative; position: fixed;
top: 0;
left: 50%;
margin-left: -600px;
} }
.cate { .cate {
float: left; float: left;