1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <template>
- <div>
- {{JSON.stringify(detail)}}
- </div>
- </template>
- <script>
- import axios from 'axios';
- export default {
- name: "index",
- data () {
- return {
- detail: {
- postId: '',
- postBizData: {
- imagePath: ''
- }
- },
- title: '',
- twitterTitle: 'deNet',
- jumpUrl: 'https://de-net-test.piaoquantv.com/'
- }
- },
- head() {
- return {
- type: '',
- title: this.title,
- meta: [
- {
- name: 'twitter:card',
- content: 'summary_large_image'
- },
- {
- name: 'twitter:url',
- content: this.jumpUrl + this.detail.postId
- },
- {
- name: 'twitter:title',
- content: this.twitterTitle
- },
- {
- name: 'twitter:image',
- content: this.detail.postBizData.imagePath || ''
- },
- {
- name: 'twitter:image:width',
- content: '1280'
- },
- {
- name: 'twitter:image:height',
- content: '720'
- },
- ]
- }
- },
- async asyncData (params) {
- let {route} = params;
- let {data} = await axios.post('https://denettestapi.piaoquantv.com/denet/post/getDetail', {
- baseInfo: {
- token: ''
- },
- params: {
- postId: route.params.id || ''
- }
- })
- if (data.code == 0) {
- if (data.data && data.data.postBizData && typeof data.data.postBizData == 'string') {
- data.data.postBizData = JSON.parse(data.data.postBizData)
- }
- return {
- detail: data.data,
- }
- }
- }
- }
- </script>
- <style scoped>
- </style>
|