85314197 2019-06-28
1、查询数据库(废话,不查数据库难道写成静态的呀,哈哈)
2、显示列表:
2.1、marked:解析makedown格式
2.2、highlight:高亮代码
2.3、以上两个组件是重点部分,一下代码重点为怎么使用:
import marked from 'marked';
import hljs from 'highlight.js';
import 'highlight.js/styles/arta.css';
--------------------------------这里放在页面渲染中-------------------------------------
marked(“这里是数据中的内容数据”);
----------------------------这里放在页面加载完成后的生命周期中-----------------
//显示代码高亮
marked.setOptions({
highlight: code => hljs.highlightAuto(code).value,
});1、react-simplemde-editor:makdown组件
import SimpleMDE from 'react-simplemde-editor';
import "simplemde/dist/simplemde.min.css";
--------------------------------这里放在页面渲染中-------------------------------------
<SimpleMDE
id="your-custom-id"
label=""
options={{
autofocus: true,
spellChecker: false,
gfm: true,
pedantic: false,
sanitize: false,
tables: true,
breaks: true,
smartLists: true,
smartypants: true,
}}
value={this.state.textValue}
onChange={this.handleChange}
/>
参数请查看官方文档1、因为是练习版本,这里直接将管理账号手动添加到了mysql 2、nodejs通过查询验证对应的账号数据,将数据保存在cookie中 这里不做详细说明,不清楚请自行nodejs学习
nodejs:https://github.com/522011796/...
react:https://github.com/522011796/...
react: http://www.rickycloud.cn/
vuejs: https://www.rickycloud.cn/