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

關(guān)于 uview-ui grid宮格布局的頁面跳轉(zhuǎn)

這篇具有很好參考價(jià)值的文章主要介紹了關(guān)于 uview-ui grid宮格布局的頁面跳轉(zhuǎn)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

在使用 uview-ui 的宮格布局時(shí),發(fā)現(xiàn)官方文檔對(duì)于基本的圖形展示還是很詳細(xì)的,但是缺少點(diǎn)擊事件。
于是文章來源地址http://www.zghlxwxcb.cn/news/detail-612209.html

眾里尋他千百度,驀然回首

基本使用

  • 該組件外層為 u-grid 組件包裹,通過 col 設(shè)置內(nèi)部宮格的列數(shù)
    內(nèi)部通過 u-grid-item 組件的 slot 設(shè)置宮格的內(nèi)容
    如果不需要宮格的邊框,可以設(shè)置 border 為 false
<template>
    <view>
        <u-grid
                :border="false"
                @click="click"
        >
            <u-grid-item
                    v-for="(baseListItem,baseListIndex) in baseList"
                    :key="baseListIndex"
            >
                <u-icon
                        :customStyle="{paddingTop:20+'rpx'}"
                        :name="baseListItem.name"
                        :size="22"
                ></u-icon>
                <text class="grid-text">{{baseListItem.title}}</text>
            </u-grid-item>
        </u-grid>
        <u-toast ref="uToast" />
    </view>
</template>

<script>
    export default {
        data() {
            return {
                baseList: [{
                    name: 'photo',
                    title: '圖片'
                    },
                    {
                        name: 'lock',
                        title: '鎖頭'
                    },
                    {
                        name: 'star',
                        title: '星星'
                    },
                ]
            }
        },
        methods: {
            click(name) {
                this.$refs.uToast.success(`點(diǎn)擊了第${name}個(gè)`)
            }
        }
    }
</script>

<style lang="scss">
    .grid-text {
        font-size: 14px;
        color: #909399;
        padding: 10rpx 0 20rpx 0rpx;
        /* #ifndef APP-PLUS */
        box-sizing: border-box;
        /* #endif */
    }
</style>

綁定點(diǎn)擊事件&自定義列數(shù)

<template>
    <view>
        <u-grid
                :border="false"
                col="4"
        >
            <u-grid-item
                    v-for="(listItem,listIndex) in list"
                    :key="listIndex"
            >
                <u-icon
                        :customStyle="{paddingTop:20+'rpx'}"
                        :name="listItem.name"
                        :size="22"
                ></u-icon>
                <text class="grid-text">{{listItem.title}}</text>
            </u-grid-item>
        </u-grid>
        <u-toast ref="uToast" />
    </view>
</template>

<script>
    export default {
        data() {
            return {
                list: [{
                    name: 'photo',
                    title: '圖片'
                    },
                    {
                        name: 'lock',
                        title: '鎖頭'
                    },
                    {
                        name: 'star',
                        title: '星星'
                    },
                    {
                        name: 'hourglass',
                        title: '沙漏'
                    },
                    {
                        name: 'home',
                        title: '首頁'
                    },
                    {
                        name: 'star',
                        title: '音量'
                    },
                ],
            }
        },
        methods: {
            click(name) {
                this.$refs.uToast.success(`點(diǎn)擊了第${name}個(gè)`)
            }
        }
    }
</script>


<style lang="scss">
    .grid-text {
        font-size: 14px;
        color: #909399;
        padding: 10rpx 0 20rpx 0rpx;
        /* #ifndef APP-PLUS */
        box-sizing: border-box;
        /* #endif */
    }
</style>

實(shí)現(xiàn)宮格的左右滑動(dòng)

  • 結(jié)合uni的swiper組件可以實(shí)現(xiàn)宮格的左右滑動(dòng),因?yàn)閟wiper特性的關(guān)系,請(qǐng)指定swiper的高度 ,否則swiper的高度不會(huì)被內(nèi)容撐開,可以自定義swiper的指示器,達(dá)到更高的靈活度
<template>
    <view>
        <swiper
                :indicator-dots="true"
                class="swiper"
        >
            <swiper-item>
                <u-grid :border="true">
                    <u-grid-item
                            :customStyle="{width:220+'rpx',height:220+'rpx'}"
                            v-for="(item, index) in swiperList"
                            :index="index"
                            :key="index"
                    >
                        <u-icon
                                :customStyle="{paddingTop:20+'rpx'}"
                                :name="item"
                                :size="22"
                        ></u-icon>
                        <text class="grid-text">{{ '宮格' + (index + 1) }}</text>
                    </u-grid-item>
                </u-grid>
            </swiper-item>
            <swiper-item>
                <u-grid :border="true">
                    <u-grid-item
                            :customStyle="{width:220+'rpx',height:220+'rpx'}"
                            v-for="(item, index) in swiperList"
                            :index="index + 9"
                            :key="index"
                    >
                        <u-icon
                                :customStyle="{paddingTop:20+'rpx'}"
                                :name="item"
                                :size="22"
                        ></u-icon>
                        <text class="grid-text">{{ '宮格' + (index + 1) }}</text>
                    </u-grid-item>
                </u-grid>
            </swiper-item>
            <swiper-item>
                <u-grid :border="true">
                    <u-grid-item
                            :customStyle="{width:220+'rpx',height:220+'rpx'}"
                            v-for="(item, index) in swiperList"
                            :index="index + 18"
                            :key="index"
                    >
                        <u-icon
                                :customStyle="{paddingTop:20+'rpx'}"
                                :name="item"
                                :size="22"
                        ></u-icon>
                        <text class="grid-text">{{ "宮格" + (index + 1) }}</text>
                    </u-grid-item>
                </u-grid>
            </swiper-item>
        </swiper>
    </view>
</template>

<script>
	export default {
		data() {
			return {
                swiperList: ['integral', 'kefu-ermai', 'coupon', 'gift', 'scan', 'pause-circle', 'wifi', 'email', 'list'],
			};
		}
	};
</script>

<style lang="scss">
    .swiper {
        height: 720rpx;
    }

    .grid-text {
        font-size: 14px;
        color: #909399;
        padding: 10rpx 0 20rpx 0rpx;
        /* #ifndef APP-PLUS */
        box-sizing: border-box;
        /* #endif */
    }
</style>

那人卻在燈火闌珊處!

  • 下面的代碼同樣可以作為 uniapp 個(gè)人主頁的 demo !
  • 僅可用于學(xué)習(xí),若用于商業(yè)用途,侵權(quán)必究?。?!
<template>
	<view class="vbox">
		<image class="top_back_img" src="../../static/dulin-setting/set-top-bg.png" mode="aspectFit"></image>
		<!-- 頭欄 -->
		<view class="top">
			<view class="circle">
				<image class="head" src="../../static/dulin-setting/head.jpg" mode="widthFix"></image>
			</view>
			<view class="top-texts">
				<text class="name">B站搜:一只小汪汪丫</text>
				<image class="set-top-hr" src="../../static/dulin-setting/set-top-hr.png" mode=""></image>
				<text class="depart">榮譽(yù)稱號(hào):專家</text>
				<view class="phoneNumber">
					<text>手機(jī)號(hào):</text>
					<text>66666666</text>
				</view>
			</view>
		</view>

		<!-- 積分,等級(jí) -->
		<view class="middle">
			<view class="middle-left">
				<image class="middle-icon" src="../../static/dulin-setting/cust.png"></image>
				<text>積分:</text>
				<text class="middle-num">2302</text>
			</view>
			<view class="middle-line"></view>
			<view class="middle-right">
				<image class="middle-icon" src="../../static/dulin-setting/loan.png"></image>
				<text>等級(jí):</text>
				<text class="middle-num">3</text>
			</view>
		</view>

		<!-- 宮格布局 -->
		<u-grid :border="false" col="3">
			<u-grid-item @click="gridClick" v-for="(listItem,listIndex) in list" :key="listIndex">
				<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="listItem.name" :size="22"></u-icon>
				<text class="grid-text">{{listItem.title}}</text>
			</u-grid-item>
		</u-grid>
		<u-toast ref="uToast" />

		<!-- 條形欄 -->
		<view class="index">
			<u-transition :show="show" mode="zoom-in">
				<view class="transition"></view>
			</u-transition>
			<view class="cell" @click="changePass">
				<view class="cell-left">
					<image class="cell_icon" src="../../static/dulin-setting/account.png"></image>
					<text class="cell-text">修改密碼</text>
				</view>
				<view class="cell-right">
					<image class="right-arrow" src="../../static/dulin-setting/right-arrow.png"></image>
				</view>
			</view>
			<view class="cell" @click="changeGray">
				<view class="cell-left">
					<image class="cell_icon" src="../../static/dulin-setting/account.png"></image>
					<text class="cell-text">檢查更新</text>
				</view>
				<view class="cell-right">
					<image class="right-arrow" src="../../static/dulin-setting/right-arrow.png"></image>
				</view>
			</view>

			<view class="cell" @click="changeUs">
				<view class="cell-left">
					<image class="cell_icon" src="../../static/dulin-setting/account.png"></image>
					<text class="cell-text">關(guān)于我們</text>
				</view>
				<view class="cell-right">
					<image class="right-arrow" src="../../static/dulin-setting/right-arrow.png"></image>
				</view>
			</view>
		</view>

		<!-- 退出登錄 -->
		<view class="logout" style="width:80%;margin-top: 50upx;">
			<button type="warn" @click="logout">退出登錄</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: true,
				list: [{
						name: 'photo',
						title: '歷史'
					},
					{
						name: 'home',
						title: '商城',
					},
					{
						name: 'star',
						title: '收藏'
					}
				],
			}
		},
		methods: {
			// 修改密碼
			changePass() {
				this.$router.push('/pages/changepw/changepw')
			},
			// 跳轉(zhuǎn)至積分商城
			gridClick(name) {
				if (name == 1)
					this.$router.push('/pages/goods-detail/sendForm')
			},
			// click(name) {
			// 	this.$refs.uToast.success('點(diǎn)擊了第${name}個(gè)')
			// },
			changeUs() {
				this.$router.push('/pages/aboutUs/aboutUs')
			},
			logout() {
				uni.showModal({
					title: '提示',
					content: '確認(rèn)退出登陸?',
					success: function(res) {
						if (res.confirm) {
							uni.removeStorage({
								key: 'token',
								success(res) {
									uni.redirectTo({
										url: '/pages/login/login'
									})
								}
							})
						} else if (res.cancel) {
							console.log('用戶點(diǎn)擊取消');
						}
					}
				});
			}
		}
	}
</script>

<style scoped>
	.index {
		display: flex;
		flex-direction: column;
		width: 100%;
		background-color: white;
		border-top: 1px solid #cccccc;
	}

	.vbox {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.top_back_img {
		z-index: -1;
		position: absolute;
		top: 0upx;
		width: 100%;
		height: 420upx;

	}

	.top {
		display: flex;
		width: 100%;
		height: 420upx;
		align-items: center;
	}

	.circle {
		margin-left: 100upx;
		width: 120upx;
		height: 120upx;
		border: 10upx solid #a4f4f6;
		border-radius: 250rpx;
		overflow: hidden;
	}

	.head {
		width: 120upx;
		height: 120upx;
		border-radius: 150upx;
	}

	.top-texts {
		display: flex;
		flex-direction: column;
		margin-left: 15upx;
		color: black;
		font-size: 24rpx;
	}

	.name {
		padding: 20rpx 10rpx;
		font-size: 36upx;
		font-weight: 500;
	}

	.set-top-hr {
		width: 210upx;
		height: 6upx;
	}

	.top-changeInfo {
		margin-top: 250upx;
		width: 120upx;
		height: 28upx;
		line-height: 28upx;
		background-color: #FFFFFF;
		border-radius: 15upx;
		padding: 10rpx;
		color: #33dce8;
	}

	.depart {
		padding: 20rpx 20rpx 0 0;
		font-size: 16rpx;
	}

	.phoneNumber {
		font-size: 16rpx;
		padding: 20rpx 20rpx 0 0;
	}

	.middle {
		display: flex;
		align-items: center;
		position: relative;
		top: -50upx;
		width: 80%;
		height: 100rpx;
		background-color: white;
		border-radius: 15upx;
	}

	.middle-line {
		width: 2rpx;
		height: 40rpx;
		background-color: #eeeeee;
	}

	.middle-left {
		flex-grow: 1;
		color: #666666;
		display: flex;
		align-items: center;
		text-align: center;
	}

	.middle-right {
		flex-grow: 1;
		color: #666666;
		display: flex;
		align-items: center;
		text-align: center;
	}

	.middle-icon {
		width: 40upx;
		height: 40upx;
		margin-left: 20upx;
	}

	.middle-num {
		color: #fcac45;
		-webkit-font-smoothing: antialiased;
	}

	.cell {
		display: flex;
		align-items: center;
		border-bottom: 1px solid #ccc;
		height: 90upx;
		align-items: center;
		justify-content: space-between;
	}

	.cell:active {
		background-color: #333;
		color: white;
		box-shadow: 1upx 1upx 35upx #ccc;
	}

	.cell-left {
		display: flex;
		align-items: center;
		margin-left: 65upx;
	}

	.cell-text {
		margin-left: 25upx;
	}

	.cell-right {
		margin-right: 45upx;
		height: 28upx;
	}

	.cell_icon {
		width: 40upx;
		height: 40upx;
		height: 40upx;
	}

	.right-arrow {
		color: #aaa;
		width: 15upx;
		height: 28upx;
	}

	.grid-text {
		font-size: 20px;
		color: #909399;
		padding: 0rpx 70rpx 20rpx 70rpx;
		/* #ifndef APP-PLUS */
		box-sizing: border-box;
		/* #endif */
	}
</style>

到了這里,關(guān)于關(guān)于 uview-ui grid宮格布局的頁面跳轉(zhuǎ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)文章

  • 使用uview-ui遇見SassError: Undefined variable

    使用uview-ui遇見SassError: Undefined variable

    1.確保安裝了 scss/sass 編譯插件 2.在根目錄下? uni.scss ?文件中引入? theme.scss 3. 確保在根目錄下 App.vue 文件中添加 lang=\\\"scss\\\" 和 index.scss 若依舊報(bào)錯(cuò): ? ?查看項(xiàng)目目錄——》 ?再把 路徑 修改為對(duì)應(yīng)文件夾下——》 @import \\\"uview-ui/theme.scss\\\"; @import \\\"uni_modules/uview-ui/theme.scss\\\"; ? ?

    2024年02月16日
    瀏覽(27)
  • uniapp 查找不到uview-ui文件怎么辦?

    uniapp 查找不到uview-ui文件怎么辦?

    ?用官方的方式總是報(bào):文件查找失?。篭\\'uview-ui\\\' at main.js 解決方案:? 1.先安裝uview-ui 下載成功是這樣的: 而不是這樣的: ? ?這樣的原因是你的項(xiàng)目里沒有package.json包,先執(zhí)行? npm? i? ?-y再安裝uview-ui 2.main.js引入 ?uni.scss中引入 然后再APP.vue中全局引入樣式,注意一定要下

    2024年02月02日
    瀏覽(41)
  • 【微信小程序-原生開發(fā)】實(shí)用教程07 - Grid 宮格導(dǎo)航,詳情頁,側(cè)邊導(dǎo)航(含自定義頁面頂部導(dǎo)航文字)

    【微信小程序-原生開發(fā)】實(shí)用教程07 - Grid 宮格導(dǎo)航,詳情頁,側(cè)邊導(dǎo)航(含自定義頁面頂部導(dǎo)航文字)

    【微信小程序-原生開發(fā)】實(shí)用教程 輪播圖、分類頁簽 tab 、成員列表(含Tdesign升級(jí),切換調(diào)試基礎(chǔ)庫(kù),設(shè)置全局樣式,配置組件按需注入,添加圖片素材,wx:for,生命周期 onLoad)

    2024年02月09日
    瀏覽(32)
  • 【uni-app】安裝uView-ui組件步驟

    【uni-app】安裝uView-ui組件步驟

    uView是uni-app生態(tài)專用的UI框架,uni-app 是一個(gè)使用 Vue.js 開發(fā)所有前端應(yīng)用的框架,開發(fā)者編寫一套代碼, 可發(fā)布到iOS、Android、H5、以及各種小程序(微信/支付寶/百度/頭條/QQ/釘釘)等多個(gè)平臺(tái)(引言自u(píng)ni-app網(wǎng))。但目前除微信小程序,其它小程序平臺(tái)的兼容可能存在一些問題,后

    2024年02月14日
    瀏覽(25)
  • uni-app項(xiàng)目使用uview-ui報(bào)錯(cuò):Component is not found in path node-modules/uview-ui/components/xx/xx

    解決: 一、uview-ui如果是 npm 安裝 需要在 pages.json 中添加 easycom 配置 二、配置了以上還報(bào)錯(cuò)的話可能是 tempalte 樣式最外層沒用標(biāo)簽包括著(只允許有一層 用 view/view 包裹最外層

    2024年02月11日
    瀏覽(18)
  • uniapp踩坑-文件查找失?。骸畊view-ui‘ at main.js

    我是在dlcoud插件庫(kù)里面下載的,默認(rèn)他默認(rèn)下載在了“uni_modules”,而我用官方的方式總是報(bào):文件查找失?。篭\\'uview-ui\\\' at main.js 以下是官方方法,但我這里一直報(bào)錯(cuò),是因?yàn)橹苯訉懰菑摹皀ode_modules”文件夾中找 23-8-21(修改):uview官網(wǎng)好像換了: Icon 圖標(biāo) | uView 2.0 - 全面兼

    2024年02月05日
    瀏覽(29)
  • uni-app使用uview-ui實(shí)現(xiàn)動(dòng)態(tài)更改底部tabbar

    需求:根據(jù)不同的權(quán)限(用戶 0, 物業(yè) 1)展示不同的tabbar 這里使用的是uview-ui@1.8.4 tabbar 在utils文件夾下新建一個(gè)tabbar.js文件,來存儲(chǔ)不同權(quán)限下的底部導(dǎo)航數(shù)據(jù) 在page.json文件里,把tabbar里的幾個(gè)頁面去重放進(jìn)去tabBar。 使用vuex 新建store 文件夾存儲(chǔ)相關(guān)數(shù)據(jù) 在入口文件 mai

    2024年02月12日
    瀏覽(31)
  • 使用vue2開發(fā)uni-app項(xiàng)目--引入uview-ui

    使用vue2開發(fā)uni-app項(xiàng)目--引入uview-ui

    提示:文章寫完后,目錄可以自動(dòng)生成,如何生成可參考右邊的幫助文檔 目錄 前言 一、安裝 1、安裝uview-ui 2、安裝scss支持 二、配置 1、在main.js中引入uView庫(kù) 2、uni.scss文件中引入uView的全局SCSS主題文件 ?3、在APP.vue文件中引入uView基礎(chǔ)樣式 4、在pages.json中 配置easycom組件模式

    2024年02月04日
    瀏覽(33)
  • 在引入uview-ui時(shí)報(bào)錯(cuò):SassError: Undefined variable: “$u-type-primary“.

    在引入uview-ui時(shí)報(bào)錯(cuò):SassError: Undefined variable: “$u-type-primary“.

    遇到的問題 解決方法:在uni.scss引入

    2024年02月16日
    瀏覽(25)
  • uniapp引入uview-ui 報(bào)錯(cuò):$u-badge-primary: $u-primary !default;

    uniapp引入uview-ui 報(bào)錯(cuò):$u-badge-primary: $u-primary !default;

    解決方法 上面這個(gè)問題是在引入 uview-ui 這個(gè)ui框架后出現(xiàn)的,那么具體的解決方法是在項(xiàng)目根目錄下的 uni.scss 文件中引入uview對(duì)應(yīng)的樣式文件: 插件地址 uni-app 插件地址(可以搜索一些其他的可用插件): https://ext.dcloud.net.cn/ uView2.0重磅發(fā)布,利劍出鞘,一統(tǒng)江湖: https:

    2024年02月11日
    瀏覽(69)

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

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

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

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

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包