<template> <view class="center"> <view class="massage" v-for="(item, index) in list" :key="index" @click="nav('/pages/index/messageInfo?id=' + item.id)"> <view class="title">{{ item.title }}</view> <view class="time">{{ item.add_time }}</view> </view> </view> </template> <script> import { article } from '@/api/user.js'; export default { data() { return { list: [], type: '' }; }, onLoad(opt) { if (opt.type) { this.type = opt.type; uni.setNavigationBarTitle({ title: opt.type == 1 ? '官方公告' : '拍品介绍' }); } let obj = this; article({ page: 1, limit: 1000 }, this.type).then(({ data }) => { this.list = data; }); }, methods: { nav(url) { uni.navigateTo({ url }); } } }; </script> <style lang="less"> .center { background: #f3f3f3; } .massage { background: #ffffff; padding: 30rpx; border-bottom: 1px solid #e9e9e9; .title { font-size: 28rpx; font-family: PingFang SC; font-weight: 500; color: #333333; } .time { margin-top: 18rpx; font-size: 20rpx; font-family: PingFang SC; font-weight: 500; color: #999999; } } </style>