JM-MiniApp/pages/wikipedia/detail.vue
2023-10-19 23:23:22 +08:00

58 lines
1.4 KiB
Vue

<script setup>
// 引入依赖
// import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
// import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
import { onLoad } from "@dcloudio/uni-app"
// import mySwiper from "@/components/mySwiper.vue"
import {ref,onMounted,nextTick} from "vue"
import {useStore} from '@/store/index.js'
import api from "@/api/index.js"
onLoad((e) => {
console.log(e)
a_info.value = JSON.parse(decodeURIComponent(e.info))
if(!e.id) {
uni.showToast({
icon:"error",
title:"错误",
duration:2000
})
a_info.value = null
return
}
getDetail(e.id)
})
// 变量
// const content = ref(null)
const a_info = ref(null)
// 函数
async function getDetail(id) {
const res = await api.getArticleDetail({id})
}
</script>
<template>
<view class="detailBox">
<view class="title">
{{a_info?.title}}
</view>
<view class="more-info small-text">2023-10-5</view>
<view class="d-content" v-html="a_info?.content"></view>
</view>
</template>
<style scoped lang="scss">
.detailBox{
.more-info{
text-align: right;
margin-bottom: 10rpx;
}
.title{
font-size: 32rpx;
font-weight: 900;
margin-bottom: 20rpx;
text-align: center;
}
padding: 40rpx;
.d-content{
line-height: 50rpx;
}
}
</style>