最近有个需求,需要做一个消息通知功能,并进行滚动,再次记录如下:
<div class="lefthead">
<div class="topselecthead">
公告通知
</div>
</div>
<div class="righthead">
<div class="topsearchhead">
<el-carousel
style="height: 33px;line-height: 33px;margin-left:15px;"
direction="vertical"
indicator-position="none"
:loop="true"
:autoplay="true"
>
<el-carousel-item v-for="(item, index) in this.noticeList" :key="index">
<p class="pr-100px cursor-pointer">
{{ item.noticeTitle }}({{item.createTime}})
</p>
</el-carousel-item>
</el-carousel>
</div>
</div>
import { noticeList } from '@/api/notice'
data() {
return {
// 通知公告
noticeList: [],
}
}
getNoticeListFun() {
noticeList().then(res => {
if (res.code !== 200) return
this.noticeList = res.rows
})
},