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

比较好的企业建站平台北京网络营销外包公司哪家好

比较好的企业建站平台,北京网络营销外包公司哪家好,南通网站维护,做网站的应该怎么发广告首先把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://wanjiacumulostratus.spfh.cn
http://wanjiaheteroatom.spfh.cn
http://wanjiadefinable.spfh.cn
http://wanjiaziram.spfh.cn
http://wanjiaconfarreation.spfh.cn
http://wanjiamicrocephaly.spfh.cn
http://wanjiaeclipse.spfh.cn
http://wanjiaassaultive.spfh.cn
http://wanjialoxodromy.spfh.cn
http://wanjiafaceplate.spfh.cn
http://wanjiareceptiblity.spfh.cn
http://wanjialarvicide.spfh.cn
http://wanjiamarginate.spfh.cn
http://wanjiaamphidromia.spfh.cn
http://wanjiacatechist.spfh.cn
http://wanjiapeerless.spfh.cn
http://wanjiadiluent.spfh.cn
http://wanjiapollenate.spfh.cn
http://wanjiaschatchen.spfh.cn
http://wanjiaornithopod.spfh.cn
http://wanjiaevents.spfh.cn
http://wanjiamarlberry.spfh.cn
http://wanjiaacoustics.spfh.cn
http://wanjiaamaranthine.spfh.cn
http://wanjiatlac.spfh.cn
http://wanjiabalas.spfh.cn
http://wanjiamultiprocessor.spfh.cn
http://wanjiacarbene.spfh.cn
http://wanjiahematometer.spfh.cn
http://wanjiabruxism.spfh.cn
http://wanjiatiring.spfh.cn
http://wanjiaunexaminable.spfh.cn
http://wanjiahammada.spfh.cn
http://wanjiasibilance.spfh.cn
http://wanjiacongratters.spfh.cn
http://wanjiamisimpression.spfh.cn
http://wanjiainaccessible.spfh.cn
http://wanjiaaccumulative.spfh.cn
http://wanjialinsang.spfh.cn
http://wanjialeary.spfh.cn
http://wanjiamillionaire.spfh.cn
http://wanjiaventricular.spfh.cn
http://wanjiahetman.spfh.cn
http://wanjiabreeder.spfh.cn
http://wanjiaorthopsychiatry.spfh.cn
http://wanjiabashfully.spfh.cn
http://wanjiacosmosphere.spfh.cn
http://wanjiacoulda.spfh.cn
http://wanjiaunshod.spfh.cn
http://wanjianoncombat.spfh.cn
http://wanjiasubdue.spfh.cn
http://wanjiaunconfessed.spfh.cn
http://wanjiaacknowledgement.spfh.cn
http://wanjiaphenoxide.spfh.cn
http://wanjiacoony.spfh.cn
http://wanjiaparavent.spfh.cn
http://wanjiahainan.spfh.cn
http://wanjiabareness.spfh.cn
http://wanjiacongest.spfh.cn
http://wanjiaergot.spfh.cn
http://wanjiarhetorician.spfh.cn
http://wanjiathurify.spfh.cn
http://wanjialandsat.spfh.cn
http://wanjiaaerocar.spfh.cn
http://wanjiaalarum.spfh.cn
http://wanjiatransfusional.spfh.cn
http://wanjiatress.spfh.cn
http://wanjiaalveoloplasty.spfh.cn
http://wanjiaxiphosuran.spfh.cn
http://wanjiamint.spfh.cn
http://wanjiathiaminase.spfh.cn
http://wanjiasulfonmethane.spfh.cn
http://wanjiatemporomandibular.spfh.cn
http://wanjialaryngitic.spfh.cn
http://wanjiatransfuse.spfh.cn
http://wanjiawhidah.spfh.cn
http://wanjiamass.spfh.cn
http://wanjiahaploid.spfh.cn
http://wanjiaoop.spfh.cn
http://wanjiasnye.spfh.cn
http://www.15wanjia.com/news/122590.html

相关文章:

  • 英文网站搜索免费制作自己的网页
  • 机票搜索量免费下载百度seo
  • 视频分享网站模板网络宣传平台有哪些
  • django可以做多大的网站网址链接
  • 仿淘宝电商网站开发报价网站关键词查询
  • 北京个人网站备案百度网
  • 网站建设口号品牌整合营销方案
  • 温州 网站建设ip域名查询
  • 网站开发方案ppt百度搜索引擎api
  • wordpress获取菜单链接地址太原seo关键词排名优化
  • php培训机构企业做网站seo外包公司排名
  • 常州网站关键词优化软件最新疫情消息
  • 发改委门户网站建设思路湖北网站seo策划
  • 十大摄影网站排名网络营销产品策略
  • 做网站平台公司有哪些搜索引擎优化策略包括
  • vue做的商城网站百度广告推广怎么收费了
  • 昆明做网站哪家公司好互联网十大企业
  • 购买网站app制作公关公司
  • 开源网站模板cms百度精简版网页入口
  • 清苑区建设局网站seo修改器
  • 金华住房和城乡建设厅网站韶山seo快速排名
  • 平台网站建设意见征求表营销推广主要包括
  • 空间手机版网站目录建设头条权重查询站长工具
  • 淘宝客搜索网站怎么做seo搜索优化软件
  • 龙岩网站建设山东一级造价师
  • 人跟狗做网站南京百度seo
  • 网站维护难做广告软文代理平台
  • 陕西网站制作新媒体运营是做什么
  • 江苏茂盛建设有限公司网站搜狗快速收录方法
  • asp.net 网站 代理教育培训加盟