• 【wiki知识库】06.文档管理页面的添加--前端Vue部分


      📝个人主页:哈__

    期待您的关注 

    目录

    一、🔥今日目标

     二、🐻前端Vue模块的改造

    BUG修改

    1.wangeditor无法展示问题

    2.弹窗无法正常关闭问题

    2.1 添加admin-doc.vue

    2.1.1 点击admin-ebook中的路由跳转到admin-doc

     2.2.2 进入到admin-doc中调用初始化查询方法

    2.2.3 文档编辑中的一些细节

    2.2.4 文档的删除

    2.2.5 admin-doc.vue全部代码

    2.2 添加DocView.vue

    2.3 添加新的路由规则


    一、🔥今日目标

    上一次带大家把前端的分类管理模块做了出来,我们可以实现网站的分类功能,以及分类的树形结构展示功能。到此为止已经带大家做了电子书管理模块、分类模块,那么只要再把文档管理模块也做出来,我们就可以初步实现电子书这整个一套流程了。我们可以编辑添加电子书,实现分类,并且真正的往电子书的文档模块中添加内容。【wiki知识库】05.分类管理实现--前端Vue模块-CSDN博客

    我们今天就要实现下方图片中箭头指向的功能

     除此之外,还有主页的展示功能。

     二、🐻前端Vue模块的改造

    在此之前我要要说一件事情,我在做这个模块的时候出现了问题,一个是我们之后要使用的文本编辑器wangeditor无法正常展示,还有一个是弹窗无法关闭的问题。这里我把解决方法告诉大家。

    BUG修改

    1.wangeditor无法展示问题

    出现这个问题可能是版本的问题,进入到我们的web目录中,打开终端窗口然后输入下方指令。重新安装wangeditor。

    npm i wangeditor@4.6.3 --save

    2.弹窗无法正常关闭问题

    这个问题是wangeditor和vue版本兼容的问题。我们需要修改一下package.json。将vue版本改成下方图中所示,注意前边的符号。


    2.1 添加admin-doc.vue

    2.1.1 点击admin-ebook中的路由跳转到admin-doc

    还记得我当初在admin-ebook.vue中写的一个router吗?在我们点击文档管理跳转到对应的组件的时候,我们是有传一个ebookId进来的,我们这里使用的是路由传参。


     2.2.2 进入到admin-doc中调用初始化查询方法

    进入到这个页面呢调用了两个方法,一个是editor.create(),用于加载我们的文本编辑器,另外一个方法调用的是handleQuery()方法,向后端发送查询请求。

    1. onMounted(() => {
    2. editor.create();
    3. handleQuery();
    4. });

     这个方法进入的时候,修改了一个变量loading,我们在进行信息查询的时候会给用户一个反馈,告诉用户稍等,我们修改为true之后就会有页面数据加载的效果。

    level1变量我们之前也说过,用于保存树形结构的数据。之后呢就会发送一个ajax请求,等我们的数据返回来之后就要把loading改为false了。

    至于下边的treeSelectData,在我们修改一个文档的父文档的时候,如果我们要把这个文档作为根文档,也就是一级文档,我们需要把这个文档的父文档设置为无,但是我们的level中存储的是数据库中查出来的数据,没有无这个选项,所以我们新加一个变量来存储level1的结果和无,这样不会影响我们查出来的数据。

    1. const handleQuery = () => {
    2. loading.value = true;
    3. // 如果不清空现有数据,则编辑保存重新加载数据后,再点编辑,则列表显示的还是编辑前的数据
    4. level1.value = [];
    5. axios.get("/doc/all/" + route.query.ebookId).then((response) => {
    6. loading.value = false;
    7. const data = response.data;
    8. if (data.success) {
    9. docs.value = data.content;
    10. console.log("原始数组:", docs.value);
    11. level1.value = [];
    12. level1.value = Tool.array2Tree(docs.value, 0);
    13. console.log("树形结构:", level1);
    14. // 父文档下拉框初始化,相当于点击新增
    15. treeSelectData.value = Tool.copy(level1.value) || [];
    16. // 为选择树添加一个"无"
    17. treeSelectData.value.unshift({id: 0, name: '无'});
    18. } else {
    19. message.error(data.message);
    20. }
    21. });
    22. };

    2.2.3 文档编辑中的一些细节

    在我们进行文档编辑的时候,我们不可能把该文档的父文档改为自己,或者改为它的子文档,这是一个循环错误。所以我们在修改一个文档的时候要把这个文档的子文档和自己设置为不可选中。

     来看看这个方法,我们把树形结构的数据,还有我们要编辑的文档的id传进来,首先进行for循环去找到这个结点,然后我们把这个节点设置为不可见,然后我们去遍历这个节点的子节点,递归调用。

    1. /**
    2. * 将某节点及其子孙节点全部置为disabled
    3. */
    4. const setDisable = (treeSelectData: any, id: any) => {
    5. // console.log(treeSelectData, id);
    6. // 遍历数组,即遍历某一层节点
    7. for (let i = 0; i < treeSelectData.length; i++) {
    8. const node = treeSelectData[i];
    9. if (node.id === id) {
    10. // 如果当前节点就是目标节点
    11. console.log("disabled", node);
    12. // 将目标节点设置为disabled
    13. node.disabled = true;
    14. // 遍历所有子节点,将所有子节点全部都加上disabled
    15. const children = node.children;
    16. if (Tool.isNotEmpty(children)) {
    17. for (let j = 0; j < children.length; j++) {
    18. setDisable(children, children[j].id)
    19. }
    20. }
    21. } else {
    22. // 如果当前节点不是目标节点,则到其子节点再找找看。
    23. const children = node.children;
    24. if (Tool.isNotEmpty(children)) {
    25. setDisable(children, id);
    26. }
    27. }
    28. }
    29. };

    2.2.4 文档的删除

    文档的删除并不只是该文档简单删除就完了,这个文档删掉之后,这个文档的所有子文档都要删除。我们之前分类管理模块也处理过这样的删除,但是我们是后端处理的删除逻辑,后端处理起来呢比较麻烦,这里我们可以使用前端处理一下。既然要删除子分支,我们就把这个要删除的文档的子文档的id都查出来一起传到后端。

    1. /**
    2. * 查找整根树枝
    3. */
    4. const getDeleteIds = (treeSelectData: any, id: any) => {
    5. // console.log(treeSelectData, id);
    6. // 遍历数组,即遍历某一层节点
    7. for (let i = 0; i < treeSelectData.length; i++) {
    8. const node = treeSelectData[i];
    9. if (node.id === id) {
    10. // 如果当前节点就是目标节点
    11. console.log("delete", node);
    12. // 将目标ID放入结果集ids
    13. // node.disabled = true;
    14. deleteIds.push(id);
    15. deleteNames.push(node.name);
    16. // 遍历所有子节点
    17. const children = node.children;
    18. if (Tool.isNotEmpty(children)) {
    19. for (let j = 0; j < children.length; j++) {
    20. getDeleteIds(children, children[j].id)
    21. }
    22. }
    23. } else {
    24. // 如果当前节点不是目标节点,则到其子节点再找找看。
    25. const children = node.children;
    26. if (Tool.isNotEmpty(children)) {
    27. getDeleteIds(children, id);
    28. }
    29. }
    30. }
    31. };

    2.2.5 admin-doc.vue全部代码

    1. <template>
    2. <a-layout>
    3. <a-layout-content
    4. :style="{ background: '#fff', padding: '24px', margin: 0, minHeight: '280px' }"
    5. >
    6. <a-row :gutter="24">
    7. <a-col :span="8">
    8. <p>
    9. <a-form layout="inline" :model="param">
    10. <a-form-item>
    11. <a-button type="primary" @click="handleQuery()">
    12. 查询
    13. a-button>
    14. a-form-item>
    15. <a-form-item>
    16. <a-button type="primary" @click="add()">
    17. 新增
    18. a-button>
    19. a-form-item>
    20. a-form>
    21. p>
    22. <a-table
    23. v-if="level1.length > 0"
    24. :columns="columns"
    25. :row-key="record => record.id"
    26. :data-source="level1"
    27. :loading="loading"
    28. :pagination="false"
    29. size="small"
    30. :defaultExpandAllRows="true"
    31. >
    32. <template #name="{ text, record }">
    33. {{record.sort}} {{text}}
    34. template>
    35. <template v-slot:action="{ text, record }">
    36. <a-space size="small">
    37. <a-button type="primary" @click="edit(record)" size="small">
    38. 编辑
    39. a-button>
    40. <a-popconfirm
    41. title="删除后不可恢复,确认删除?"
    42. ok-text="是"
    43. cancel-text="否"
    44. @confirm="handleDelete(record.id)"
    45. >
    46. <a-button type="danger" size="small">
    47. 删除
    48. a-button>
    49. a-popconfirm>
    50. a-space>
    51. template>
    52. a-table>
    53. a-col>
    54. <a-col :span="16">
    55. <p>
    56. <a-form layout="inline" :model="param">
    57. <a-form-item>
    58. <a-button type="primary" @click="handleSave()">
    59. 保存
    60. a-button>
    61. a-form-item>
    62. a-form>
    63. p>
    64. <a-form :model="doc" layout="vertical">
    65. <a-form-item>
    66. <a-input v-model:value="doc.name" placeholder="名称"/>
    67. a-form-item>
    68. <a-form-item>
    69. <a-tree-select
    70. v-model:value="doc.parent"
    71. style="width: 100%"
    72. :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
    73. :tree-data="treeSelectData"
    74. placeholder="请选择父文档"
    75. tree-default-expand-all
    76. :replaceFields="{title: 'name', key: 'id', value: 'id'}"
    77. >
    78. a-tree-select>
    79. a-form-item>
    80. <a-form-item>
    81. <a-input v-model:value="doc.sort" placeholder="顺序"/>
    82. a-form-item>
    83. <a-form-item>
    84. <a-button type="primary" @click="handlePreviewContent()">
    85. <EyeOutlined /> 内容预览
    86. a-button>
    87. a-form-item>
    88. <a-form-item>
    89. <div id="content">div>
    90. a-form-item>
    91. a-form>
    92. a-col>
    93. a-row>
    94. <a-drawer width="900" placement="right" :closable="false" :visible="drawerVisible" @close="onDrawerClose">
    95. <div class="wangeditor" :innerHTML="previewHtml">div>
    96. a-drawer>
    97. a-layout-content>
    98. a-layout>
    99. template>
    100. <script lang="ts">
    101. import { defineComponent, onMounted, ref, createVNode } from 'vue';
    102. import axios from 'axios';
    103. import {message, Modal} from 'ant-design-vue';
    104. import {Tool} from "@/util/tool";
    105. import {useRoute} from "vue-router";
    106. import ExclamationCircleOutlined from "@ant-design/icons-vue/ExclamationCircleOutlined";
    107. import E from 'wangeditor'
    108. export default defineComponent({
    109. name: 'AdminDoc',
    110. setup() {
    111. const route = useRoute();
    112. console.log("路由:", route);
    113. console.log("route.path:", route.path);
    114. console.log("route.query:", route.query);
    115. console.log("route.param:", route.params);
    116. console.log("route.fullPath:", route.fullPath);
    117. console.log("route.name:", route.name);
    118. console.log("route.meta:", route.meta);
    119. const param = ref();
    120. param.value = {};
    121. const docs = ref();
    122. const loading = ref(false);
    123. // 因为树选择组件的属性状态,会随当前编辑的节点而变化,所以单独声明一个响应式变量
    124. const treeSelectData = ref();
    125. treeSelectData.value = [];
    126. const columns = [
    127. {
    128. title: '名称',
    129. dataIndex: 'name',
    130. slots: { customRender: 'name' }
    131. },
    132. {
    133. title: 'Action',
    134. key: 'action',
    135. slots: { customRender: 'action' }
    136. }
    137. ];
    138. const level1 = ref(); // 一级文档树,children属性就是二级文档
    139. level1.value = [];
    140. /**
    141. * 数据查询
    142. **/
    143. const handleQuery = () => {
    144. loading.value = true;
    145. // 如果不清空现有数据,则编辑保存重新加载数据后,再点编辑,则列表显示的还是编辑前的数据
    146. level1.value = [];
    147. axios.get("/doc/all/" + route.query.ebookId).then((response) => {
    148. loading.value = false;
    149. const data = response.data;
    150. if (data.success) {
    151. docs.value = data.content;
    152. console.log("原始数组:", docs.value);
    153. level1.value = [];
    154. level1.value = Tool.array2Tree(docs.value, 0);
    155. console.log("树形结构:", level1);
    156. // 父文档下拉框初始化,相当于点击新增
    157. treeSelectData.value = Tool.copy(level1.value) || [];
    158. // 为选择树添加一个"无"
    159. treeSelectData.value.unshift({id: 0, name: '无'});
    160. } else {
    161. message.error(data.message);
    162. }
    163. });
    164. };
    165. // -------- 表单 ---------
    166. const doc = ref();
    167. doc.value = {
    168. ebookId: route.query.ebookId
    169. };
    170. const modalVisible = ref(false);
    171. const modalLoading = ref(false);
    172. const editor = new E('#content');
    173. editor.config.zIndex = 0;
    174. // 显示上传图片按钮,转成Base64存储,同时也支持拖拽图片
    175. editor.config.uploadImgShowBase64 = true;
    176. const handleSave = () => {
    177. modalLoading.value = true;
    178. doc.value.content = editor.txt.html();
    179. axios.post("/doc/save", doc.value).then((response) => {
    180. modalLoading.value = false;
    181. const data = response.data; // data = commonResp
    182. if (data.success) {
    183. // modalVisible.value = false;
    184. message.success("保存成功!");
    185. // 重新加载列表
    186. handleQuery();
    187. } else {
    188. message.error(data.message);
    189. }
    190. });
    191. };
    192. /**
    193. * 将某节点及其子孙节点全部置为disabled
    194. */
    195. const setDisable = (treeSelectData: any, id: any) => {
    196. // console.log(treeSelectData, id);
    197. // 遍历数组,即遍历某一层节点
    198. for (let i = 0; i < treeSelectData.length; i++) {
    199. const node = treeSelectData[i];
    200. if (node.id === id) {
    201. // 如果当前节点就是目标节点
    202. console.log("disabled", node);
    203. // 将目标节点设置为disabled
    204. node.disabled = true;
    205. // 遍历所有子节点,将所有子节点全部都加上disabled
    206. const children = node.children;
    207. if (Tool.isNotEmpty(children)) {
    208. for (let j = 0; j < children.length; j++) {
    209. setDisable(children, children[j].id)
    210. }
    211. }
    212. } else {
    213. // 如果当前节点不是目标节点,则到其子节点再找找看。
    214. const children = node.children;
    215. if (Tool.isNotEmpty(children)) {
    216. setDisable(children, id);
    217. }
    218. }
    219. }
    220. };
    221. const deleteIds: Array = [];
    222. const deleteNames: Array = [];
    223. /**
    224. * 查找整根树枝
    225. */
    226. const getDeleteIds = (treeSelectData: any, id: any) => {
    227. // console.log(treeSelectData, id);
    228. // 遍历数组,即遍历某一层节点
    229. for (let i = 0; i < treeSelectData.length; i++) {
    230. const node = treeSelectData[i];
    231. if (node.id === id) {
    232. // 如果当前节点就是目标节点
    233. console.log("delete", node);
    234. // 将目标ID放入结果集ids
    235. // node.disabled = true;
    236. deleteIds.push(id);
    237. deleteNames.push(node.name);
    238. // 遍历所有子节点
    239. const children = node.children;
    240. if (Tool.isNotEmpty(children)) {
    241. for (let j = 0; j < children.length; j++) {
    242. getDeleteIds(children, children[j].id)
    243. }
    244. }
    245. } else {
    246. // 如果当前节点不是目标节点,则到其子节点再找找看。
    247. const children = node.children;
    248. if (Tool.isNotEmpty(children)) {
    249. getDeleteIds(children, id);
    250. }
    251. }
    252. }
    253. };
    254. /**
    255. * 内容查询
    256. **/
    257. const handleQueryContent = () => {
    258. axios.get("/doc/find-content/" + doc.value.id).then((response) => {
    259. const data = response.data;
    260. if (data.success) {
    261. editor.txt.html(data.content)
    262. } else {
    263. message.error(data.message);
    264. }
    265. });
    266. };
    267. /**
    268. * 编辑
    269. */
    270. const edit = (record: any) => {
    271. // 清空富文本框
    272. editor.txt.html("");
    273. modalVisible.value = true;
    274. doc.value = Tool.copy(record);
    275. handleQueryContent();
    276. // 不能选择当前节点及其所有子孙节点,作为父节点,会使树断开
    277. treeSelectData.value = Tool.copy(level1.value);
    278. setDisable(treeSelectData.value, record.id);
    279. // 为选择树添加一个"无"
    280. treeSelectData.value.unshift({id: 0, name: '无'});
    281. };
    282. /**
    283. * 新增
    284. */
    285. const add = () => {
    286. // 清空富文本框
    287. editor.txt.html("");
    288. modalVisible.value = true;
    289. doc.value = {
    290. ebookId: route.query.ebookId
    291. };
    292. treeSelectData.value = Tool.copy(level1.value) || [];
    293. // 为选择树添加一个"无"
    294. treeSelectData.value.unshift({id: 0, name: '无'});
    295. };
    296. const handleDelete = (id: number) => {
    297. // console.log(level1, level1.value, id)
    298. // 清空数组,否则多次删除时,数组会一直增加
    299. deleteIds.length = 0;
    300. deleteNames.length = 0;
    301. getDeleteIds(level1.value, id);
    302. Modal.confirm({
    303. title: '重要提醒',
    304. icon: createVNode(ExclamationCircleOutlined),
    305. content: '将删除:【' + deleteNames.join(",") + "】删除后不可恢复,确认删除?",
    306. onOk() {
    307. // console.log(ids)
    308. axios.delete("/doc/delete/" + deleteIds.join(",")).then((response) => {
    309. const data = response.data; // data = commonResp
    310. if (data.success) {
    311. // 重新加载列表
    312. handleQuery();
    313. } else {
    314. message.error(data.message);
    315. }
    316. });
    317. },
    318. });
    319. };
    320. // ----------------富文本预览--------------
    321. const drawerVisible = ref(false);
    322. const previewHtml = ref();
    323. const handlePreviewContent = () => {
    324. const html = editor.txt.html();
    325. previewHtml.value = html;
    326. drawerVisible.value = true;
    327. };
    328. const onDrawerClose = () => {
    329. drawerVisible.value = false;
    330. };
    331. onMounted(() => {
    332. editor.create();
    333. handleQuery();
    334. });
    335. return {
    336. param,
    337. // docs,
    338. level1,
    339. columns,
    340. loading,
    341. handleQuery,
    342. edit,
    343. add,
    344. doc,
    345. modalVisible,
    346. modalLoading,
    347. handleSave,
    348. handleDelete,
    349. treeSelectData,
    350. drawerVisible,
    351. previewHtml,
    352. handlePreviewContent,
    353. onDrawerClose,
    354. }
    355. }
    356. });
    357. script>
    358. <style scoped>
    359. img {
    360. width: 50px;
    361. height: 50px;
    362. }
    363. style>

    2.2 添加DocView.vue

    这个组件呢就是为了在主页展示文档数据。但是其中的一些功能后端还未实现。

    1. <template>
    2. <a-layout>
    3. <a-layout-content :style="{ background: '#fff', padding: '24px', margin: 0, minHeight: '280px' }">
    4. <h3 v-if="level1.length === 0">对不起,找不到相关文档!h3>
    5. <a-row>
    6. <a-col :span="6">
    7. <a-tree
    8. v-if="level1.length > 0"
    9. :tree-data="level1"
    10. @select="onSelect"
    11. :replaceFields="{title: 'name', key: 'id', value: 'id'}"
    12. :defaultExpandAll="true"
    13. :defaultSelectedKeys="defaultSelectedKeys"
    14. >
    15. a-tree>
    16. a-col>
    17. <a-col :span="18">
    18. <div>
    19. <h2>{{doc.name}}h2>
    20. <div>
    21. <span>阅读数:{{doc.viewCount}}span>    
    22. <span>点赞数:{{doc.voteCount}}span>
    23. div>
    24. <a-divider style="height: 2px; background-color: #9999cc"/>
    25. div>
    26. <div class="wangeditor" :innerHTML="html">div>
    27. <div class="vote-div">
    28. <a-button type="primary" shape="round" :size="'large'" @click="vote">
    29. <template #icon><LikeOutlined />  点赞:{{doc.voteCount}} template>
    30. a-button>
    31. div>
    32. a-col>
    33. a-row>
    34. a-layout-content>
    35. a-layout>
    36. template>
    37. <script lang="ts">
    38. import { defineComponent, onMounted, ref, createVNode } from 'vue';
    39. import axios from 'axios';
    40. import {message} from 'ant-design-vue';
    41. import {Tool} from "@/util/tool";
    42. import {useRoute} from "vue-router";
    43. export default defineComponent({
    44. name: 'Doc',
    45. setup() {
    46. const route = useRoute();
    47. const docs = ref();
    48. const html = ref();
    49. const defaultSelectedKeys = ref();
    50. defaultSelectedKeys.value = [];
    51. // 当前选中的文档
    52. const doc = ref();
    53. doc.value = {};
    54. const level1 = ref(); // 一级文档树,children属性就是二级文档
    55. level1.value = [];
    56. /**
    57. * 内容查询
    58. **/
    59. const handleQueryContent = (id: number) => {
    60. axios.get("/doc/find-content/" + id).then((response) => {
    61. const data = response.data;
    62. if (data.success) {
    63. html.value = data.content;
    64. } else {
    65. message.error(data.message);
    66. }
    67. });
    68. };
    69. /**
    70. * 数据查询
    71. **/
    72. const handleQuery = () => {
    73. axios.get("/doc/all/" + route.query.ebookId).then((response) => {
    74. const data = response.data;
    75. if (data.success) {
    76. docs.value = data.content;
    77. level1.value = [];
    78. level1.value = Tool.array2Tree(docs.value, 0);
    79. if (Tool.isNotEmpty(level1)) {
    80. defaultSelectedKeys.value = [level1.value[0].id];
    81. handleQueryContent(level1.value[0].id);
    82. // 初始显示文档信息
    83. doc.value = level1.value[0];
    84. }
    85. } else {
    86. message.error(data.message);
    87. }
    88. });
    89. };
    90. const onSelect = (selectedKeys: any, info: any) => {
    91. console.log('selected', selectedKeys, info);
    92. if (Tool.isNotEmpty(selectedKeys)) {
    93. // 选中某一节点时,加载该节点的文档信息
    94. doc.value = info.selectedNodes[0].props;
    95. // 加载内容
    96. handleQueryContent(selectedKeys[0]);
    97. }
    98. };
    99. // 点赞
    100. const vote = () => {
    101. axios.get('/doc/vote/' + doc.value.id).then((response) => {
    102. const data = response.data;
    103. if (data.success) {
    104. doc.value.voteCount++;
    105. } else {
    106. message.error(data.message);
    107. }
    108. });
    109. };
    110. onMounted(() => {
    111. handleQuery();
    112. });
    113. return {
    114. level1,
    115. html,
    116. onSelect,
    117. defaultSelectedKeys,
    118. doc,
    119. vote
    120. }
    121. }
    122. });
    123. script>
    124. <style>
    125. /* table 样式 */
    126. .wangeditor table {
    127. border-top: 1px solid #ccc;
    128. border-left: 1px solid #ccc;
    129. }
    130. .wangeditor table td,
    131. .wangeditor table th {
    132. border-bottom: 1px solid #ccc;
    133. border-right: 1px solid #ccc;
    134. padding: 3px 5px;
    135. }
    136. .wangeditor table th {
    137. border-bottom: 2px solid #ccc;
    138. text-align: center;
    139. }
    140. /* blockquote 样式 */
    141. .wangeditor blockquote {
    142. display: block;
    143. border-left: 8px solid #d0e5f2;
    144. padding: 5px 10px;
    145. margin: 10px 0;
    146. line-height: 1.4;
    147. font-size: 100%;
    148. background-color: #f1f1f1;
    149. }
    150. /* code 样式 */
    151. .wangeditor code {
    152. display: inline-block;
    153. *display: inline;
    154. *zoom: 1;
    155. background-color: #f1f1f1;
    156. border-radius: 3px;
    157. padding: 3px 5px;
    158. margin: 0 3px;
    159. }
    160. .wangeditor pre code {
    161. display: block;
    162. }
    163. /* ul ol 样式 */
    164. .wangeditor ul, ol {
    165. margin: 10px 0 10px 20px;
    166. }
    167. /* 和antdv p冲突,覆盖掉 */
    168. .wangeditor blockquote p {
    169. font-family:"YouYuan";
    170. margin: 20px 10px !important;
    171. font-size: 16px !important;
    172. font-weight:600;
    173. }
    174. /* 点赞 */
    175. .vote-div {
    176. padding: 15px;
    177. text-align: center;
    178. }
    179. /* 图片自适应 */
    180. .wangeditor img {
    181. max-width: 100%;
    182. height: auto;
    183. }
    184. /* 视频自适应 */
    185. .wangeditor iframe {
    186. width: 100%;
    187. height: 400px;
    188. }
    189. style>

    2.3 添加新的路由规则

    在router下的index.js中新增两个路由规则。

    1. {
    2. path: '/doc',
    3. name: 'doc',
    4. component:DocView
    5. },
    6. {
    7. path: '/admin/doc',
    8. name: 'AdminDoc',
    9. component: AdminDoc
    10. }

    后续我会把后端的代码补上的。

  • 相关阅读:
    C++基础02
    Java习题:第三章 面向对象
    在别人眼中,pmp有什么作用?
    智能汽车安全:保护车辆远程控制和数据隐私
    Powershell 实现禁用密码复杂性,空密码
    elasticsearch-6.8.5升级至6.8.22
    Docker中使用Tomcat并部署war工程
    isset()函数判断变量是否设置且非NULL
    平安城市与智能交通系统建设方案
    ResNet分类器量化
  • 原文地址:https://blog.csdn.net/qq_61024956/article/details/139562619