电脑知识|欧美黑人一区二区三区|软件|欧美黑人一级爽快片淫片高清|系统|欧美黑人狂野猛交老妇|数据库|服务器|编程开发|网络运营|知识问答|技术教程文章 - 好吧啦网

您的位置:首頁技術文章
文章詳情頁

vue基于better-scroll仿京東分類列表

瀏覽:129日期:2022-06-12 08:45:36

本文實例為大家分享了vue基于better-scroll仿京東分類列表的具體代碼,供大家參考,具體內容如下

效果圖目錄結構

vue基于better-scroll仿京東分類列表

vue基于better-scroll仿京東分類列表

vue基于better-scroll仿京東分類列表

1、main.js(需要安裝router)

import Vue from ’vue’import App from ’./App.vue’import router from ’./router’import ’../src/assets/js/mock’import axios from ’axios’ axios.defaults.baseURL=’http://mockjs.com/api’Vue.prototype.$http=axiosVue.config.productionTip = false new Vue({ router, render: h => h(App)}).$mount(’#app’)

2、router.js

如果字體圖標引入錯誤,百度阿里字體圖標引入方法

import Vue from ’vue’import Router from ’vue-router’import ’./assets/css/iconfont.css’ //全局引入字體圖標 Vue.use(Router) export default new Router({ linkExactActiveClass:’active’, mode: ’history’, base: process.env.BASE_URL, routes: [ { path: ’/’, name: ’home’, component: ()=>import(’./views/home.vue’) }, { path: ’/class’, name: ’class’, component: () => import(’./views/class.vue’) }, { path: ’/shopcart’, name: ’shopcart’, component: () => import(’./views/shopcart.vue’) }, { path:’/me’, name:’me’, component:()=>import(’./views/me.vue’) } ]})

3、App.vue

<template> <div id='app'> <router-view></router-view> <v-tabbar></v-tabbar> </div></template><script>import tabbar from ’../components/tabbar’;export default { components:{ ’v-tabbar’:tabbar, },}</script> <style lang='scss'>* { margin: 0; padding: 0;}html { height: 100%;}body { height: 100%; background-color: #efeff4;}a { text-decoration: none; color: #000;}li { list-style: none;}.clearfix:after { content: ’.’; display: block; clear: both; visibility: hidden; height: 0; font-size: 0;}#app { font-family: 'Avenir', Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; color: #2c3e50; height: 100%;}</style>

4、tabbar.vue

<template> <div class='tabbar'> <div class='tabbar'> <router-link to='/' exact> <i class='iconfont'>&#xe5ad;</i> <p>首頁</p> </router-link> <router-link to='/class'> <i class='iconfont'>&#xe62f;</i> <p>分類</p> </router-link> <router-link to='/shopcart'> <i class='iconfont'>&#xe660;</i> <p>購物車</p> </router-link> <router-link to='/me'> <i class='iconfont'>&#xe60d;</i> <p>我的</p> </router-link> </div> </div></template><style lang='scss' scoped>.tabbar { position: fixed; display: flex; bottom: 0; left: 0; width: 100%; height: 42px; padding-top: 8px; background-color: #fff; .tab_list { flex: 1; i { font-size: 18px; } p { font-size: 14px; } } .active { color: #ffaf77; }}</style>5、class.vue<template> <div class='class'> <div class='head'> <i class='iconfont'>&#xe62d;</i> <span>分類</span> </div> <div class='main'> <div ref='wrapper'> <ul class='content'> <!-- 分類列表 --> <li v-for='(item,index) in detialList' :key='index' @click='listClick(index)' :class='index===active?’active’:’’'>{{item.list}}</li> </ul> </div> <div class='detialList_box'> <!-- 分類詳情列表 --> <ul v-for='(item,index) in detialList' v-show='index===active' :key='index'> <li class='detial_title'>{{item.list}}</li> <li v-for='(item,index) in item.detial' :key='index'> <img :src='http://www.hdgsjgj.cn/bcjs/item.src' alt=''> <p>{{item.text}}</p> </li> </ul> <div class='padding_color'></div> </div> </div> </div></template><script>import BScroll from 'better-scroll';export default { data() { return { detialList: [ //分類數據 { list:’保健品’, detial:[ {src:require(’../assets/images/shop1.png’),text:’愛他美’}, {src:require(’../assets/images/shop1.png’),text:’愛他美’}, {src:require(’../assets/images/shop1.png’),text:’愛他美’}, {src:require(’../assets/images/shop1.png’),text:’愛他美’}, {src:require(’../assets/images/shop1.png’),text:’愛他美’}, {src:require(’../assets/images/shop1.png’),text:’愛他美’}, ] }, { list:’酒水’, detial:[ {src:require(’../assets/images/shop1.png’),text:’酒水’}, {src:require(’../assets/images/shop1.png’),text:’酒水’}, {src:require(’../assets/images/shop1.png’),text:’酒水’}, {src:require(’../assets/images/shop1.png’),text:’酒水’}, {src:require(’../assets/images/shop1.png’),text:’酒水’}, {src:require(’../assets/images/shop1.png’),text:’酒水’}, ] }, { list:’茶葉’, detial:[ {src:require(’../assets/images/shop1.png’),text:’茶葉’}, {src:require(’../assets/images/shop1.png’),text:’茶葉’}, {src:require(’../assets/images/shop1.png’),text:’茶葉’}, {src:require(’../assets/images/shop1.png’),text:’茶葉’}, {src:require(’../assets/images/shop1.png’),text:’茶葉’}, {src:require(’../assets/images/shop1.png’),text:’茶葉’}, ] }, { list:’農產品’, detial:[ {src:require(’../assets/images/shop1.png’),text:’農產品’}, {src:require(’../assets/images/shop1.png’),text:’農產品’}, {src:require(’../assets/images/shop1.png’),text:’農產品’}, {src:require(’../assets/images/shop1.png’),text:’農產品’}, {src:require(’../assets/images/shop1.png’),text:’農產品’}, {src:require(’../assets/images/shop1.png’),text:’農產品’}, ] }, ], active:0, detialtext:’保健品’ }; }, methods: { listClick(index){ //顯示隱藏分類詳情 this.active=index; this.detialtext=index; } }, created() { // mockjs模擬數據 // this.$http.get('/detial').then(res => { // this.detialList=res.data.detials // }); }, mounted() { this.$nextTick(() => { this.scroll = new BScroll(this.$refs.wrapper, { //better-scroll初始化 scrollY, //豎向滾動 click:true //滾動區域可觸發點擊事件 }); }); }};</script><style lang='scss' scoped>.class { height: 100%; .head { position: fixed; z-index: 999; top: 0; left: 0; height: 44px; width: 100%; line-height: 44px; text-align: center; color: #fff; background-color: #ff8c3c; i { position: absolute; left: 10px; } } .main { display: flex; height: 100%; .wrapper { overflow: hidden; width: 80px; height: 100%; background-color: #fff; .content { padding-top: 40px; padding-bottom: 80px; li { height: 40px; width: 80px; line-height: 40px; padding-left: 10px; text-align: left; background-color: #fff; border: 1px solid #efeff4; } .active { background-color: #efeff4; border-left: 2px solid #ff0000; } } } .detialList_box { flex: 1; overflow: hidden; margin: 0 8px; background-color: #fff; .detialList { padding-bottom: 20px; li { float: left; width: 33.3333333%; img { width: 100%; } } .detial_title{ height: 40px; width: 100%; line-height: 40px; margin-top: 40px; background-color: #efeff4; } } .padding_color { background-color: #efeff4; height: 100%; } } }}</style>

關于vue.js組件的教程,請大家點擊專題vue.js組件學習教程進行學習。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: 京東
相關文章:
主站蜘蛛池模板: 海鲜池-专注海鲜鱼缸、移动海鲜缸、饭店鱼缸设计定做-日晟水族厂家 | 净化工程_无尘车间_无尘车间装修-广州科凌净化工程有限公司 | 真空泵维修保养,普发,阿尔卡特,荏原,卡西亚玛,莱宝,爱德华干式螺杆真空泵维修-东莞比其尔真空机电设备有限公司 | SDG吸附剂,SDG酸气吸附剂,干式酸性气体吸收剂生产厂家,超过20年生产使用经验。 - 富莱尔环保设备公司(原名天津市武清县环保设备厂) | 能量回馈_制动单元_电梯节能_能耗制动_深圳市合兴加能科技有限公司 | 北京百度网站优化|北京网站建设公司-百谷网络科技 | POM塑料_PBT材料「进口」聚甲醛POM杜邦原料、加纤PBT塑料报价格找利隆塑料 | 山东包装,山东印刷厂,济南印刷厂-济南富丽彩印刷有限公司 | MES系统-WMS系统-MES定制开发-制造执行MES解决方案-罗浮云计算 | 双杰天平-国产双杰电子天平-美国双杰-常熟双杰仪器 | 粘度计,数显粘度计,指针旋转粘度计| 生物除臭剂-除味剂-植物-污水除臭剂厂家-携葵环保有限公司 | 棕刚玉-白刚玉厂家价格_巩义市东翔净水材料厂 | 德州网站开发定制-小程序开发制作-APP软件开发-「两山开发」 | 1000帧高速摄像机|工业高速相机厂家|科天健光电技术 | 济南侦探调查-济南调查取证-山东私家侦探-山东白豹调查咨询公司 密集架|电动密集架|移动密集架|黑龙江档案密集架-大量现货厂家销售 | 药品仓库用除湿机-变电站用防爆空调-油漆房用防爆空调-杭州特奥环保科技有限公司 | 液压扳手-高品质液压扳手供应商 - 液压扳手, 液压扳手供应商, 德国进口液压拉马 | 医疗仪器模块 健康一体机 多参数监护仪 智慧医疗仪器方案定制 血氧监护 心电监护 -朗锐慧康 | 青岛成人高考_山东成考报名网| 天一线缆邯郸有限公司_煤矿用电缆厂家_矿用光缆厂家_矿用控制电缆_矿用通信电缆-天一线缆邯郸有限公司 | 悬浮拼装地板_篮球场木地板翻新_运动木地板价格-上海越禾运动地板厂家 | 工业插头-工业插头插座【厂家】-温州罗曼电气 | 丙烷/液氧/液氮气化器,丙烷/液氧/液氮汽化器-无锡舍勒能源科技有限公司 | 烟雾净化器-滤筒除尘器-防爆除尘器-除尘器厂家-东莞执信环保科技有限公司 | 圣才学习网-考研考证学习平台,提供万种考研考证电子书、题库、视频课程等考试资料 | 高压无油空压机_无油水润滑空压机_水润滑无油螺杆空压机_无油空压机厂家-科普柯超滤(广东)节能科技有限公司 | 过滤器_自清洗过滤器_气体过滤器_苏州华凯过滤技术有限公司 | 不锈钢/气体/液体玻璃转子流量计(防腐,选型,规格)-常州天晟热工仪表有限公司【官网】 | (中山|佛山|江门)环氧地坪漆,停车场地板漆,车库地板漆,聚氨酯地板漆-中山永旺地坪漆厂家 | SPC工作站-连杆综合检具-表盘气动量仪-内孔缺陷检测仪-杭州朗多检测仪器有限公司 | 细砂提取机,隔膜板框泥浆污泥压滤机,螺旋洗砂机设备,轮式洗砂机械,机制砂,圆锥颚式反击式破碎机,振动筛,滚筒筛,喂料机- 上海重睿环保设备有限公司 | 空冷器|空气冷却器|空水冷却器-无锡赛迪森机械有限公司[官网] | 东亚液氮罐-液氮生物容器-乐山市东亚机电工贸有限公司 | 西安展台设计搭建_西安活动策划公司_西安会议会场布置_西安展厅设计西安旭阳展览展示 | 光伏支架成型设备-光伏钢边框设备-光伏设备厂家 | 甲级防雷检测仪-乙级防雷检测仪厂家-上海胜绪电气有限公司 | 广域铭岛Geega(际嘉)工业互联网平台-以数字科技引领行业跃迁 | 河南空气能热水器-洛阳空气能采暖-洛阳太阳能热水工程-洛阳润达高科空气能商行 | 工业设计,人工智能,体验式3D展示的智能技术交流服务平台-纳金网 J.S.Bach 圣巴赫_高端背景音乐系统_官网 | 量子管通环-自清洗过滤器-全自动反冲洗过滤器-北京罗伦过滤技术集团有限公司 |