12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <template>
- <view class="container">
- <view v-if="list.length > 0" class="list-box flex_item" v-for="(ls,index) in list" :key='index' @click="nav(index)">
- <image :src="ls.image_input[0]"></image>
- <view class="list-item">
- <view class="title ellipsis">{{ls.title}}</view>
- <view class="time">{{ls.add_time}}</view>
- </view>
- </view>
- <view class="empty-box" v-show="list.length === 0"><u-empty></u-empty></view>
- </view>
- </template>
- <script>
- import { article } from '@/api/user.js';
- export default {
- data() {
- return {
- list:''
- };
- },
- onLoad(option){
- this.loadData();
- },
- onShow() {
-
- },
- methods: {
- // 请求载入数据
- async loadData() {
- let obj = this;
- article({
- page:1,
- limit:10000
- }).then(({ data }) => {
- console.log(data)
- obj.list = data;
- });
- },
- nav(index){
- uni.navigateTo({
- url: '/pages/index/article?id=' + this.list[index].id
- })
- },
- }
- };
- </script>
- <style lang="scss">
- page {
- min-height: 100%;
- background-color: #ffffff;
- .container {
- width: 100%;
- padding: 25rpx 27rpx;
-
- }
- }
- .empty-box{
- margin-top: 100rpx;
- width: 100%;
- height: 500rpx;
- }
- .list-box{
- border-bottom: 1rpx solid #E3E3E3;
- margin-bottom: 25rpx;
- padding-bottom: 25rpx;
- image{
- width: 200rpx;
- height: 160rpx;
- border-radius: 15rpx;
- }
- .list-item{
- padding-left: 16rpx;
- width: 80%;
- .title{
- height: 80rpx;
- color: #333333;
- font-size: 30rpx;
- font-weight: 500;
- }
- .time{
- padding-top: 40rpx;
- color: #999999;
- font-size: 24rpx;
- }
- }
- }
- </style>
|