关于文章跳转

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> <template>
<div class="wrapper"> <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> </div>
</template> </template>
<script> <script>
import { getArticleDetail } from "@/api/article"; import { getArticleDetailByType } from "@/api/article";
export default { export default {
data() { data() {
return { return {
@ -40,9 +40,10 @@ export default {
methods: { methods: {
init(option) { init(option) {
getArticleDetail(this.way[option.type].type).then((res) => { getArticleDetailByType(this.way[option.type].type).then((res) => {
if (res.data.success) { if (res.data.success) {
this.res = res.data.result; this.res = res.data.result;
console.log(res)
} }
}); });
}, },