首页初次对接口

This commit is contained in:
clay
2022-12-25 16:05:39 +08:00
parent 4050e638f0
commit fd6f5b5390
7 changed files with 305 additions and 191 deletions

View File

@@ -1,18 +1,18 @@
<template>
<view style="padding: 12rpx 16rpx;">
<view class="xwD_title">
{{title}}
{{detailList.title}}
</view>
<view style="display: flex;">
<text class="xwD_time">
{{time}}
{{detailList.pub_time}}
</text>
<text class="xwD_time xwD_place">
{{place}}
{{detailList.pub_name}}
</text>
</view>
<view class="xwD_content">
<u-parse :content="news" @preview="preview" @navigate="navigate"></u-parse>
<u-parse :content="detailList.content" @preview="preview" @navigate="navigate"></u-parse>
</view>
</view>
</template>
@@ -21,14 +21,28 @@
export default {
data() {
return {
title: '2022近50款食品饮料新品创新的方向都在这里',
time: '2022-12-03 09:59',
place: '第一食品资讯官方账号',
news: '<h1>一级标题</h1><br/><h2>二级标题</h2>'
id: '',
detailList: []
// title: '2022近50款食品饮料新品创新的方向都在这里',
// time: '2022-12-03 09:59',
// place: '第一食品资讯官方账号',
// news: '<h1>一级标题</h1><br/><h2>二级标题</h2>'
}
},
onLoad(option) {
console.log('新闻详情id', option.id);
this.id = option.id
this.getNewsDetail()
},
methods: {
//获取行业新闻详情
getNewsDetail() {
this.$apiServe.getNewsDetail(this.id).then(res => {
console.log('新闻详情页', res.data.data)
this.detailList = res.data.data
}).finally(_ => {})
},
}
}
</script>