国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

uniApp開發(fā)小程序自定義tabBar底部導(dǎo)航欄+tabBar中間凸起自定義樣式實(shí)現(xiàn)

這篇具有很好參考價(jià)值的文章主要介紹了uniApp開發(fā)小程序自定義tabBar底部導(dǎo)航欄+tabBar中間凸起自定義樣式實(shí)現(xiàn)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

????????先看效果是否可以滿足你們,如果可以滿足你只要一步一步照著做絕對(duì)沒有錯(cuò)。

????????本人技術(shù)不佳,研究了一整天,全網(wǎng)的大佬們寫的博客看的暈頭轉(zhuǎn)向,避免大伙再走彎路,跟著我以下步驟一點(diǎn)一點(diǎn)來絕對(duì)可以實(shí)現(xiàn)。

????????最終效果圖: (如果你看著還滿意的話那就跟著教程一步一步來吧)

u-tabbar centeritem,uniApp,筆記

首先你要確保你的項(xiàng)目中安裝了 uview的UI框架和vuex,具體安裝教程這兩個(gè)網(wǎng)上都有詳細(xì)教程,我這項(xiàng)目是Vue3.0的,用的是uview-plus框架。

第一步:配置信息

pages.js 添加 "custom": true 屬性

u-tabbar centeritem,uniApp,筆記

第二步:添加自定義tabBar代碼文件

注意:這里是按官方要求必須放在項(xiàng)目根目錄下,而且文件名不能修改,index中代碼如下:

u-tabbar centeritem,uniApp,筆記

<template>
	<view>
		<u-tabbar :value="index" @change="tabBarChange" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true"
			activeColor="#d81e06">
			<u-tabbar-item text="首頁">
				<template #active-icon>
					<image class="u-page__item__slot-icon" :src="list[0].selectedIconPath"></image>
				</template>
				<template #inactive-icon>
					<image class="u-page__item__slot-icon" :src="list[0].iconPath"></image>
				</template>
			</u-tabbar-item>

			<u-tabbar-item text="轉(zhuǎn)讓">
				<template #active-icon>
					<image class="u-page__item__slot-icon" :src="list[1].selectedIconPath"></image>
				</template>
				<template #inactive-icon>
					<image class="u-page__item__slot-icon" :src="list[1].iconPath"></image>
				</template>
			</u-tabbar-item>

			<u-tabbar-item @click="show = true">
				<template #active-icon>
					<image class="u-page__item__slot-icon-big" :src="list[2].selectedIconPath">
					</image>
				</template>
				<template #inactive-icon>
					<image class="u-page__item__slot-icon-big" :src="list[2].iconPath"></image>
				</template>
			</u-tabbar-item>

			<u-tabbar-item text="積分">
				<template #active-icon>
					<image class="u-page__item__slot-icon" :src="list[3].selectedIconPath"></image>
				</template>
				<template #inactive-icon>
					<image class="u-page__item__slot-icon" :src="list[3].iconPath"></image>
				</template>
			</u-tabbar-item>

			<u-tabbar-item text="我的">
				<template #active-icon>
					<image class="u-page__item__slot-icon" :src="list[4].selectedIconPath"></image>
				</template>
				<template #inactive-icon>
					<image class="u-page__item__slot-icon" :src="list[4].iconPath"></image>
				</template>
			</u-tabbar-item>
		</u-tabbar>
		<view>
			<u-popup :overlayOpacity="0.6" :round="10" :show="show" @close="close" @open="open">
				<view class="issue-item">
					<view class="issue-item-buy" @click="toBuy">
						<text>我要賣</text>
					</view>
					<view class="issue-item-sell">
						<text>我要買</text>
					</view>
				</view>
			</u-popup>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				list: [{
						"pagePath": "/pages/index/index",
						"text": "首頁",
						"iconPath": "/static/tabs/home_default.png",
						"selectedIconPath": "/static/tabs/home_selected.png"
					},
					{
						"pagePath": "/pages/makeOver/makeOver",
						"text": "轉(zhuǎn)讓",
						"iconPath": "/static/tabs/mass_default.png",
						"selectedIconPath": "/static/tabs/mass_selected.png"
					},
					{
						"pagePath": "/pages/issue/issue",
						"text": "發(fā)布",
						"iconPath": "/static/images/tab_issue.png",
						"selectedIconPath": "/static/images/tab_issue.png"
					},
					{
						"pagePath": "/pages/integral/integral",
						"text": "積分",
						"iconPath": "/static/tabs/mass_default.png",
						"selectedIconPath": "/static/tabs/mass_selected.png"
					},
					{
						"pagePath": "/pages/my/my",
						"text": "我的",
						"iconPath": "/static/tabs/my_default.png",
						"selectedIconPath": "/static/tabs/my_selected.png"
					}
				]
			}
		},
		computed: {
			index() {
				return this.$store.state.tabbarIndex
			}
		},
		methods: {
			tabBarChange(e) {
				if (e !== 2) {
					uni.switchTab({
						url: this.list[e].pagePath
					})
				}
			},
			//點(diǎn)擊發(fā)布按鈕的彈出層
			open() {
				console.log('open');
			},
			close() {
				this.show = false;
				console.log('close');
			},
			//點(diǎn)擊我要賣
			toBuy() {
				console.log("點(diǎn)擊了");
				uni.switchTab({
					url: '/pages/issue/issue'
				})
			}
		}
	}
</script>

<style lang="scss">
	.u-page__item__slot-icon {
		width: 50rpx;
		height: 50rpx;
	}

	.u-page__item__slot-icon-big {
		width: 120rpx;
		height: 120rpx;
		margin-bottom: 30rpx;
	}

	.issue-item {
		height: 400rpx;
		display: flex;
		justify-content: center;
		align-items: center;

		.issue-item-buy,
		.issue-item-sell {
			width: 30%;
			height: 100rpx;
			font-size: 28rpx;
			border-radius: 20rpx;
			background-color: pink;
			margin: 40rpx;
			line-height: 100rpx;
			text-align: center;
		}
	}
</style>

?下面我給大家先講講實(shí)現(xiàn)的邏輯,首先逛了一天的博客,有的人用for循環(huán)來做,剛開始我也用循環(huán),但是我中間有個(gè)凸起的發(fā)布按鈕,我想做出點(diǎn)擊后有彈出層,然后再選擇的功能,按照網(wǎng)上他們說的去做都直接跳轉(zhuǎn)了,我這點(diǎn)擊發(fā)布效果如下圖:? 沒辦法我只能我只有會(huì)寫死,反正后面這個(gè)換的也不是太頻繁。

u-tabbar centeritem,uniApp,筆記

我再講講代碼中需要注意的點(diǎn)吧,首先 如下圖的value值我綁定的computed計(jì)算屬性中的index,然后methods中的tabBarChange方法呢是點(diǎn)擊tabBar切換的每一項(xiàng),下面我又加個(gè)if判斷就是用來控制中間發(fā)布的那個(gè)圖標(biāo)點(diǎn)擊后不跳轉(zhuǎn)

u-tabbar centeritem,uniApp,筆記

?u-tabbar centeritem,uniApp,筆記

?以上配置好后,那就在每一個(gè)跳轉(zhuǎn)頁配一下代碼,作用是用來更store中的changgeTabbarIndex的值,也就是確保頁面跳轉(zhuǎn)后,圖標(biāo)選中你所點(diǎn)擊的那個(gè)頁面,我這里每個(gè)頁面都配置了一下。代碼如下:

		onShow() {
			this.$store.commit('changeTabbarIndex', 1)
		},

u-tabbar centeritem,uniApp,筆記

u-tabbar centeritem,uniApp,筆記

第三步:安裝配置vuex

?首先說為什么要安裝vuex,因?yàn)橥ㄟ^vuex來實(shí)現(xiàn)組件和組件之間數(shù)據(jù)傳遞,當(dāng)你點(diǎn)擊不同tabBar來回切換的時(shí)候把對(duì)應(yīng)的值存在store中。

安裝命令:npm install vuex --save

配置vuex:項(xiàng)目根目錄下新建 store/index.js文件,代碼如下:

u-tabbar centeritem,uniApp,筆記

import {
	createStore
} from 'vuex'

const store = createStore({
	//全局狀態(tài)
	state: {
		tabbarIndex: 0,
	},
	//同步的方法,commit
	mutations: {
		changeTabbarIndex(state, index) {
			state.tabbarIndex = index;
			console.log('uvexIndex',state.tabbarIndex);
		}
	},
	//異步的方法 dispatch
	actions: {

	}
})

export default store

第四步:配置主入口文件

u-tabbar centeritem,uniApp,筆記

?到這里就已經(jīng)完成了,這是本人第一個(gè)小程序項(xiàng)目,希望能給新手們帶來點(diǎn)幫助,歡迎大佬們前來批評(píng)指正。文章來源地址http://www.zghlxwxcb.cn/news/detail-761339.html

到了這里,關(guān)于uniApp開發(fā)小程序自定義tabBar底部導(dǎo)航欄+tabBar中間凸起自定義樣式實(shí)現(xiàn)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 小程序自定義tabbar,中間凸起

    微信小程序自帶tabbar,但無法實(shí)現(xiàn)中間按鈕凸起樣式和功能,因此按照設(shè)計(jì)重新自定義一個(gè)tabbar 如需源碼,請(qǐng)點(diǎn)擊下載源碼,或點(diǎn)擊頂部下載按鈕

    2024年02月08日
    瀏覽(20)
  • uniapp自定義tabbar(支持中間凸起,角標(biāo),動(dòng)態(tài)隱藏tab,全端適用)

    uniapp自定義tabbar(支持中間凸起,角標(biāo),動(dòng)態(tài)隱藏tab,全端適用)

    在使用uniapp進(jìn)行開發(fā)時(shí),tabbar是我們使用的很頻繁的一個(gè)組件,但是在特定的平臺(tái)會(huì)有一些使用上的限制,無法通過一套代碼來做通用平臺(tái)的適配。比如說中間按鈕凸起,動(dòng)態(tài)隱藏某個(gè)tab(不同角色展示不同功能),使用字體圖標(biāo),數(shù)字角標(biāo)等,這些功能不是所有平臺(tái)都支持

    2024年02月02日
    瀏覽(28)
  • 鴻蒙開發(fā)自定義tabbar,帶中間凸起按鈕

    鴻蒙開發(fā)自定義tabbar,帶中間凸起按鈕

    今天要分享的是開發(fā)一個(gè)自定義tabbar,因?yàn)楹灹吮C軈f(xié)議的緣故,所以本項(xiàng)目還是基于鴻蒙4.0。 先看效果圖: 自己做的圖標(biāo)不太美觀,大家見諒哈哈哈。 這種帶中間凸起的tabbar在項(xiàng)目中非常常見,但是我研究了一下系統(tǒng)的tabbar是不支持這樣設(shè)置的,所以我們就自己開發(fā)一個(gè)

    2024年04月17日
    瀏覽(29)
  • 微信小程序自定義tabbar【中間凸起樣式】

    微信小程序自定義tabbar【中間凸起樣式】

    效果預(yù)覽 微信開發(fā)文檔:自定義tabBar 一、配置信息 在 app.json 中的 tabBar 中指定 custom 字段為 true【允許使用自定義 tabBar】 在所有 tab 頁 json 中申明usingComponents 項(xiàng),或者在 app.json 中全局開啟 在 list 中指定自己需要 tab 示例 二、添加 tabBar 代碼文件 在代碼根目錄下添加custom-

    2024年02月10日
    瀏覽(28)
  • 前端Vue自定義tabbar底部tabbar凸起tabbar兼容蘋果劉海屏小程序和APP

    前端Vue自定義tabbar底部tabbar凸起tabbar兼容蘋果劉海屏小程序和APP

    前端Vue組件化開發(fā):自定義tabbar組件的設(shè)計(jì)與實(shí)現(xiàn)??兼容蘋果劉海屏小程序和APP 摘要: 隨著前端開發(fā)技術(shù)的不斷發(fā)展,組件化開發(fā)成為了提高開發(fā)效率和降低維護(hù)成本的有效手段。本文將介紹一款基于Vue的前端自定義tabbar組件的設(shè)計(jì)與實(shí)現(xiàn),該組件具有單獨(dú)開發(fā)、單獨(dú)維護(hù)

    2024年02月11日
    瀏覽(24)
  • uni-app 實(shí)現(xiàn)凸起的 tabbar 底部導(dǎo)航欄

    uni-app 實(shí)現(xiàn)凸起的 tabbar 底部導(dǎo)航欄

    效果圖 在?pages.json 中設(shè)置隱藏自帶的 tabbar 導(dǎo)航欄 新建一個(gè) custom-tabbar.vue 自定義組件頁面 底部安全區(qū)域的適配問題可查看:uni-app 蘋果手機(jī)底部安全區(qū)域的適配問題 在 main.js 中引用組件 在要用到的頁面中直接調(diào)用

    2024年02月07日
    瀏覽(25)
  • uniapp 開發(fā)小程序之實(shí)現(xiàn)不同身份展示不同的 tabbar(底部導(dǎo)航欄),附帶相關(guān)問題解答

    uniapp 開發(fā)小程序之實(shí)現(xiàn)不同身份展示不同的 tabbar(底部導(dǎo)航欄),附帶相關(guān)問題解答

    效果展示: ? 引言 在開發(fā)過程中逐漸意識(shí)到uniapp原生的tabbar可能不能滿足開發(fā)要求,通過瀏覽博客才選擇使用uView的Tabbar 底部導(dǎo)航欄來實(shí)現(xiàn),我選擇用的是2X版本 安裝 我是使用Hbuilder插件的方式引入的組件庫(kù),安裝配置可以看這篇: 下載安裝方式配置 | uView 2.0 - 全面兼容

    2024年02月11日
    瀏覽(29)
  • 微信小程序自定義導(dǎo)航欄機(jī)型適配--底部Tabbar--view高度--底部按鈕適配

    微信小程序自定義導(dǎo)航欄機(jī)型適配--底部Tabbar--view高度--底部按鈕適配

    自定義微信小程序頭部導(dǎo)航欄 自定義微信小程序頭部導(dǎo)航欄,有幾種方式 方式一 定義此方法后,頭部的導(dǎo)航欄會(huì)去掉,導(dǎo)航欄下的元素會(huì)直接向上移動(dòng)到原導(dǎo)航欄的位置,可以再app.json配置成全局沉浸式導(dǎo)航欄,以及在單頁面配置沉浸式導(dǎo)航欄。 方式二 使用組件 這里使用

    2024年02月02日
    瀏覽(24)
  • 微信小程序自定義tabbar導(dǎo)航欄,中間凸出樣式

    微信小程序自定義tabbar導(dǎo)航欄,中間凸出樣式

    這種樣式的底部導(dǎo)航欄 使用微信小程序的自定義tabBar:微信小程序官方說明 uni.app=在? page.json ? 中的? tabBar ?項(xiàng)指定? custom ? 字段為true: 在根目錄創(chuàng)建custom-tab-bar目錄, 注意一定要完全匹配,不要輸錯(cuò) : ?index.js代碼: 注意這里的中間需要凸出項(xiàng)設(shè)置一個(gè)class index.json代碼

    2024年02月09日
    瀏覽(34)
  • 詳細(xì)介紹uniapp小程序自定義底部tabbar樣式的方法

    uniapp自帶的tabbar組件可以方便地實(shí)現(xiàn)底部導(dǎo)航欄的功能,原生tabBar是相對(duì)固定的配置方式,但是默認(rèn)的樣式可能無法滿足我們的需求,所以我們需要自定義設(shè)置tabbar樣式。下面我會(huì)詳細(xì)介紹uniapp自定義tabbar樣式的方法。 一、pages.json代碼 pages.json這里只配置頁面路徑就可以。

    2024年02月02日
    瀏覽(33)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包