You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
cesuan/pages/knowlegelist/knowlegelist.vue

111 lines
1.6 KiB

<template>
<view class="container">
<view v-if="list.length>0" class="item" @click="jumdetail(item.id)" v-for="item in list">
<view><img :src="item.image" alt=""></view>
<view class="i-r">
<view class="i-h">{{item.title}}</view>
<view class="i-v">阅读:{{item.view}}</view>
<view class="i-b">{{item.created_at}}</view>
</view>
</view>
<view v-if="list.length==0" class="nonedata" >
当前没有数据
</view>
</view>
</template>
<script>
import * as UserApi from '@/api/user'
export default {
data() {
return {
list:[
],
}
},
onLoad(options)
{
if(options.cat_id)
{
UserApi.knowledgeList({category_id:options.cat_id})
.then(result => {
this.list = result.data.list;
console.log(this.list);
})
}
},
methods: {
jumdetail(id)
{
this.$navTo('pages/knowlege/knowlege',{id:id});
}
}
}
</script>
<style>
.container
{
background-color: #efefef;
padding:20rpx 30rpx;
min-height: 100vh;
}
.item
{
display: flex;
align-items: center;
padding:20rpx;
background-color: #fff;
border-radius: 20rpx;
}
.item img
{
height:160rpx;
width:160rpx;
border-radius: 15rpx;
margin-right: 20rpx;
}
.item .i-r
{
height: 160rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.i-h
{
font-size: 32rpx;
font-weight: bold;
}
.i-v
{
font-size: 26rpx;
color:#aaa;
}
.i-b
{
font-size: 28rpx;
}
.nonedata
{
width: 100%;;
padding:20rpx;
text-align: center;
font-size: 30rpx;
color:#aaa;
}
</style>