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;
		}
	}
}
相关推荐
三声三视6 小时前
uni-app 鸿蒙端传参变成 [object Object]?顺着源码追到 ArkTS router 底层才搞明白
人工智能·ai·uni-app·aigc·ai编程·harmonyos
小徐_233314 小时前
Open Wot 1.0.5 发布:让 AI 接入 wot-ui,只需要两条命令
前端·uni-app·ai编程
AI多Agent协作实战派18 小时前
AI多Agent协作系统实战(二十二):从6列到12列——任务监控报告的进化之路
java·人工智能·uni-app·bug
小杨小杨、努力变强!20 小时前
VS Code运行HBuilder X中的uni-app项目
vscode·uni-app·uni-app run
码兄科技1 天前
实战:基于Spring Boot + UniApp的地理信息小程序开发
spring boot·后端·uni-app
2501_916007472 天前
iOS和macOS应用程序性能分析和优化工具使用综合指南
android·macos·ios·小程序·uni-app·iphone·webview
2501_916007473 天前
深入理解HTTPS对称与非对称加密机制及Charles抓包实践
网络协议·http·ios·小程序·https·uni-app·iphone
小徐_23333 天前
AI 写 wot-ui 总在猜 API?我们把 Skills、MCP 和 CLI 都配好了
前端·uni-app·ai编程
Liu.7743 天前
uni-app 组件 uni-easyinput 常见 Bug 及解决方案
uni-app·bug
小徐_23333 天前
uni-app 项目别再从零搭了!3 个 Wot UI 起手模板怎么选?
前端·uni-app