63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
// @ts-nocheck
|
|
import { Component } from "react";
|
|
import { View, Text, Image } from "@tarojs/components";
|
|
import "./index.scss";
|
|
import { AtButton, AtInput, AtTabBar } from "taro-ui";
|
|
import React, { useCallback, useEffect, useState } from "react";
|
|
import { AtGrid } from "taro-ui";
|
|
import { Swiper, SwiperItem } from "@tarojs/components";
|
|
import { AtCard } from "taro-ui";
|
|
import { AtImagePicker } from "taro-ui";
|
|
import Taro from "@tarojs/taro";
|
|
import { AtAvatar } from "taro-ui";
|
|
import { AtTag } from "taro-ui";
|
|
import { AtList, AtListItem } from "taro-ui";
|
|
import { AtForm, AtMessage } from "taro-ui";
|
|
import { marked } from "marked";
|
|
import markdownText from "./text.md";
|
|
|
|
marked.setOptions({
|
|
breaks: true, // 是否回车换行
|
|
gfm: true, //使用经批准的 GitHub Flavored Markdown (GFM) 规范
|
|
// pedantic: true, //严格模式
|
|
// highlight(code:any, lang:any) {
|
|
// // 语法高亮
|
|
// let val = code;
|
|
// if (lang) {
|
|
// val = hljs.highlight(lang, code).value;
|
|
// } else {
|
|
// val = hljs.highlightAuto(code).value;
|
|
// }
|
|
// return val;
|
|
// },
|
|
});
|
|
|
|
// const renderer = new marked.Renderer();
|
|
// // 使用拓展
|
|
// marked.use({ renderer });
|
|
|
|
// export default class Index extends Component {
|
|
const Book = () => {
|
|
const [markText, setmarkText] = useState();
|
|
|
|
useEffect(() => {}, []);
|
|
|
|
const handleClick = (value) => {
|
|
// 跳转到目的页面,在当前页面打开
|
|
Taro.navigateTo({
|
|
url: "/pages/index/index",
|
|
});
|
|
};
|
|
|
|
return (
|
|
<View className="Book">
|
|
<View
|
|
className="markdown-body" // 添加 GitHub Markdown 主题类
|
|
dangerouslySetInnerHTML={{ __html: marked(markdownText) }}
|
|
></View>
|
|
</View>
|
|
);
|
|
};
|
|
|
|
export default Book;
|