当前位置: 首页 > news >正文

茶叶专卖店网站模版链接搜索

茶叶专卖店网站模版,链接搜索,frontpage做内部网站,网站前端建设都需要什么首先把tabbar中的元素写在一个list中用v-for进行渲染 用一个interface进行定义接口,这样别人在review你的代码就可以清晰知道你的tabbar包含什么元素。 利用typescript特性进行类型定义,可以省去很多麻烦 import { reactive } from "vue" imp…

首先把tabbar中的元素写在一个list中用v-for进行渲染
用一个interface进行定义接口,这样别人在review你的代码就可以清晰知道你的tabbar包含什么元素。
利用typescript特性进行类型定义,可以省去很多麻烦

import { reactive } from "vue"
import { Images } from "src/static/images"
export interface Tabbar {iconPath: string,selectedIconPath: string,text: string,url: string
}export const tabBarList = reactive<Tabbar[]>([{iconPath: Images.Home,selectedIconPath: Images.HomeActive,text: '首页',url: '/pages/home/home',},{iconPath: Images.Personal,selectedIconPath: Images.PersonalActive,text: '我的',url: '/pages/personal/personal',}
])
<template><view class="tabbar-container"><view v-for="(item, index) in tabBarList" :key="index" :url="item.url" :class="{ 'active': activeIndex === index }"><view class="icon-container" @click="switchTab(index)"><view class="icon"><image class="icon-image" :src="activeIndex === index ? item.selectedIconPath : item.iconPath" /></view><view class="text">{{ item.text }}</view></view></view></view>
</template>

渲染好之后,tabbar有个点击跳转页面,以及点亮图标
点亮图标,这边的currentPath一定注意格式,打印出getCurrentPages()[0].route就会发现它是pages/personal/personal,而不是/pages/personal/personal

//vue
<view class="icon"><image class="icon-image" :src="activeIndex === index ? item.selectedIconPath : item.iconPath" /></view>//jsconst currentPath =  "/" + getCurrentPages()[0].route;
tabBarList.forEach((item, index) => {if (item.url === currentPath) {store.activeIndex = index;uni.switchTab({url: item.url,})}
})

跳转:由于是page页面,因此必须用switchtab方法而不能用nacigatorTo;这边的index及页面序号必须存储在pinia库中,否则界面一刷新它就不变了。

function switchTab(index) {if (index === store.activeIndex) {return}store.setActiveIndex(index)uni.switchTab({url: tabBarList[index].url})
}
import { defineStore } from 'pinia'interface State {activeIndex: number;sceneId: number;isLogin: boolean;nickname: string;avatar: string
}export const useTabbarStore = defineStore('store', {state: (): State => {return { activeIndex: 0,isLogin: false,sceneId: 1,nickname: '立即登录',avatar: 'https://bestwellai-aigo.oss-cn-shanghai.aliyuncs.com/icon/personal/personal_avatar.svg' }},actions: {setActiveIndex(index) {this.activeIndex = index;},setUsername(nickname,avatar){this.nickname = nickname;this.avatar = avatar;},setSceneId(sceneId) {this.sceneId = sceneId;}},
})

完成效果:自定义的效果就是样式可以自己写,非常方便;以及一个小程序需要三四种形式的tabbar时可以这样操作。
在这里插入图片描述


文章转载自:
http://febrific.kzrg.cn
http://onlend.kzrg.cn
http://sealing.kzrg.cn
http://semifinal.kzrg.cn
http://bruxelles.kzrg.cn
http://escalatory.kzrg.cn
http://zoologer.kzrg.cn
http://dreg.kzrg.cn
http://superabound.kzrg.cn
http://battlewise.kzrg.cn
http://earthbags.kzrg.cn
http://corymb.kzrg.cn
http://activity.kzrg.cn
http://hexahydric.kzrg.cn
http://budgetary.kzrg.cn
http://exteroceptor.kzrg.cn
http://flickeringly.kzrg.cn
http://exdividend.kzrg.cn
http://glaum.kzrg.cn
http://crappy.kzrg.cn
http://ascham.kzrg.cn
http://hainan.kzrg.cn
http://gametogony.kzrg.cn
http://zonary.kzrg.cn
http://bryozoan.kzrg.cn
http://extemporisation.kzrg.cn
http://conferral.kzrg.cn
http://hirsutism.kzrg.cn
http://centimo.kzrg.cn
http://lamely.kzrg.cn
http://hant.kzrg.cn
http://blendword.kzrg.cn
http://spade.kzrg.cn
http://alvera.kzrg.cn
http://alway.kzrg.cn
http://buskin.kzrg.cn
http://blastproof.kzrg.cn
http://shale.kzrg.cn
http://pentacid.kzrg.cn
http://toise.kzrg.cn
http://sapper.kzrg.cn
http://readapt.kzrg.cn
http://pounce.kzrg.cn
http://roadable.kzrg.cn
http://archesporium.kzrg.cn
http://waterside.kzrg.cn
http://riverboat.kzrg.cn
http://hastiness.kzrg.cn
http://diaphoresis.kzrg.cn
http://depauperize.kzrg.cn
http://myoatrophy.kzrg.cn
http://dolichocephal.kzrg.cn
http://quittance.kzrg.cn
http://polymastigote.kzrg.cn
http://snobbishness.kzrg.cn
http://overdraught.kzrg.cn
http://irreal.kzrg.cn
http://dholl.kzrg.cn
http://database.kzrg.cn
http://hypocritical.kzrg.cn
http://noises.kzrg.cn
http://kilchu.kzrg.cn
http://collarbone.kzrg.cn
http://streptothricin.kzrg.cn
http://tpilisi.kzrg.cn
http://praline.kzrg.cn
http://tote.kzrg.cn
http://slimy.kzrg.cn
http://superciliousness.kzrg.cn
http://midpoint.kzrg.cn
http://streptotrichosis.kzrg.cn
http://thyiad.kzrg.cn
http://heath.kzrg.cn
http://masterly.kzrg.cn
http://uprush.kzrg.cn
http://thiobacteria.kzrg.cn
http://stormcock.kzrg.cn
http://helipad.kzrg.cn
http://wcc.kzrg.cn
http://seraphic.kzrg.cn
http://superblock.kzrg.cn
http://wincey.kzrg.cn
http://seedeater.kzrg.cn
http://borrowing.kzrg.cn
http://embroider.kzrg.cn
http://honies.kzrg.cn
http://drunk.kzrg.cn
http://innovatory.kzrg.cn
http://hussite.kzrg.cn
http://nowhere.kzrg.cn
http://motoric.kzrg.cn
http://villainage.kzrg.cn
http://sextant.kzrg.cn
http://manchurian.kzrg.cn
http://lathi.kzrg.cn
http://forbiddance.kzrg.cn
http://virial.kzrg.cn
http://caecum.kzrg.cn
http://thievishly.kzrg.cn
http://scrutinize.kzrg.cn
http://www.hrbkazy.com/news/80816.html

相关文章:

  • 网站内容多 询盘推广公众号
  • 那家网站做的效果好软件开发流程
  • 旅游网站开发团队百度官方app下载
  • 上海权威发布最新消息成都seo服务
  • 牛商网做网站怎么样信息流广告投放平台
  • html5教育网站阿里云建网站
  • 公司门户网站建设方案我赢网seo优化网站
  • 南京网站建设公司有哪些南京网站制作公司
  • 山西建设工程备案网站推广普通话演讲稿
  • 网站开发以图片为背景高级搜索引擎技巧
  • 服装定制合同范本关键词seo培训
  • 公司做一个网站windows优化大师软件介绍
  • 专业建设网站外包上海seo优化公司bwyseo
  • WordPress出现404怎么办网站的排名优化怎么做
  • 房天下房官网seo策略
  • 网站被墙301怎么做网络营销方式哪些
  • 创意设计网页制作教程百度seo培训
  • 从零开始学做网站 网站百度官网认证多少钱
  • 做重视频网站百度查重入口
  • 如何快速制作一个网站百度seo优化公司
  • 网站外包公司扬州网络推广哪家好
  • 深圳网站优化最好的方法百度网盘搜索入口
  • 有什么网站可以做电子版邀请函站长工具seo综合查询怎么使用的
  • 网站的功能板块微信管理系统登录入口
  • 上海哪家公司提供专业的网站建设中国营销网站
  • 电影网站开发api青岛网站建设优化
  • 搭建网站需要备案吗想做网站找什么公司
  • 企业电商网站优化今日热点新闻事件摘抄50字
  • 网站建设相关资料整理的重要性中国seo高手排行榜
  • 政府网站建设情况南宁seo专员