关于文章跳转

master
chc 2022-10-28 10:46:51 +08:00
parent 2e4bedae31
commit 558a3228be
2 changed files with 17 additions and 3 deletions

View File

@ -28,3 +28,16 @@ export function getArticleDetail(type) {
});
}
/**
* 获取文章详情
* @param type
*/
export function getArticleDetailByType(type) {
return http.request({
url: `/other/article/type/${type}`,
method: Method.GET,
});
}

View File

@ -1,11 +1,11 @@
<template>
<div class="wrapper">
<u-parse :show-with-animation="true" :lazy-load="true" :selectable="true" :html="res.content"></u-parse>
<u-parse :show-with-animation="true" :lazy-load="true" :selectable="true" :html="res.content" v-if="res"></u-parse>
</div>
</template>
<script>
import { getArticleDetail } from "@/api/article";
import { getArticleDetailByType } from "@/api/article";
export default {
data() {
return {
@ -40,9 +40,10 @@ export default {
methods: {
init(option) {
getArticleDetail(this.way[option.type].type).then((res) => {
getArticleDetailByType(this.way[option.type].type).then((res) => {
if (res.data.success) {
this.res = res.data.result;
console.log(res)
}
});
},