uniapp+vue3——通知栏标题纵向滚动切换

介绍

取巧,使用纵向轮播实现

html 复制代码
<!-- 通知栏 -->
<view class="noticeBox" v-if="notice.length>0">
	<image src="/static/images/index/noticeIcon.png" mode="aspectFill"></image>
	<swiper class="noticeSwiper" vertical circular autoplay>
		<swiper-item v-for="(item,index) in notice" :key="index">
			<view class="noticeTxt">{{item.title}}</view>
		</swiper-item>
	</swiper>
</view>
javascript 复制代码
const notice = ref([])
onLoad((options) => {
	getIndexNotice()
})
//公告
const getIndexNotice = () => {
	api.getIndexNotice().then(res => {
		if (res.code == 1) {
			notice.value = res.data
		}
	})
}
css 复制代码
.noticeBox {
	height: 72rpx;
	background-color: #ffffff;
	border-radius: 40rpx;
	margin-top: 24rpx;
	color: var(--fui-color-txt);
	font-size: 26rpx;
	display: flex;
	align-items: center;
	padding: 0 28rpx;

	image {
		width: 40rpx;
		height: 40rpx;
		margin-right: 20rpx;
		flex-shrink: 0;
	}

	.noticeSwiper {
		width: 100%;
		height: 100%;

		.noticeTxt {
			width: 100%;
			height: 100%;
			line-height: 72rpx;
			white-space: nowrap;
			text-overflow: ellipsis;
			overflow: hidden;
		}
	}
}
相关推荐
996幸存者2 小时前
uni-app区域选择、支持静态、动态数据
微信小程序·uni-app
ᥬ 小月亮3 小时前
Uniapp编写微信小程序,绘制动态圆环进度条
微信小程序·小程序·uni-app
The_era_achievs_hero10 小时前
UniappDay03
vue.js·微信小程序·uni-app
游戏开发爱好者81 天前
没有 Mac,如何上架 iOS App?多项目复用与流程标准化实战分享
android·ios·小程序·https·uni-app·iphone·webview
Python大数据分析1 天前
uniapp之微信小程序标题对其右上角按钮胶囊
微信小程序·小程序·uni-app
一只一只妖1 天前
uniapp小程序上传图片并压缩
小程序·uni-app
顽疲2 天前
从零用java实现 小红书 springboot vue uniapp(14) 集成阿里云短信验证码
java·vue.js·spring boot·阿里云·uni-app
The_era_achievs_hero2 天前
uni-appDay02
javascript·vue.js·微信小程序·uni-app
FliPPeDround2 天前
@uni-helper 社区:让 uni-app 拥抱 ESM 时代
前端·uni-app·vite