医学道
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
video/src/pages/brand/article/article.tsx

28 lines
768 B

import {FC, useEffect, useState} from "react";
import {View} from "@tarojs/components";
import Taro, {useRouter} from "@tarojs/taro";
import {ArticleRecord, brandApi} from "@/api";
const article:FC = () => {
const {id} = useRouter().params as unknown as { id: number}
const [articleInfo,setArticleInfo] = useState<ArticleRecord>()
useEffect(() => {
getData()
}, [id])
const getData = async () => {
try {
const data = await brandApi.articleInfo(id)
Taro.setNavigationBarTitle({title:data.title})
setArticleInfo(data)
} catch (e) {
}
}
function helloWorld() {
const html = articleInfo?.content;
return <View dangerouslySetInnerHTML={{ __html: html! }}></View>
}
return helloWorld()
}
export default article