File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
apps/workspace/module/managementPlatform/component/library Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ export default {
52
52
});
53
53
},
54
54
saveContent (value , render ) {
55
+ /**
56
+ * 备注:因为mavonEditor在把md转换为html时会自动给链接加上target="_blank",但如果链接本身href是以#开头,则忽略
57
+ * 所以,如果需要在文章内部继续做链接跳转其他内置文章,可以把href设置为#id的形式
58
+ */
55
59
SaveChapter ({
56
60
id: this .$route .query .id ,
57
61
content: value,
Original file line number Diff line number Diff line change @@ -35,9 +35,13 @@ export default {
35
35
handleAnchor (e ) {
36
36
// 文章内部链接跳转处理
37
37
if (e .target .tagName == " A" && e .target .target != " _blank" ) {
38
- const match = e .target .href .match (/ \/ \d + \. html/ g ); // 暂定/17.html的格式
38
+ /**
39
+ * 备注:因为mavonEditor在把md转换为html时会自动给链接加上target="_blank",但如果链接本身href是以#开头,则忽略
40
+ * 所以,如果需要在文章内部继续做链接跳转其他内置文章,可以把href设置为#id的形式
41
+ */
42
+ const match = e .target .href .match (/ #\d + / g ); // id的格式为#id
39
43
if (match && match[0 ]) {
40
- const id = match[0 ].match ( / \d + / g )[ 0 ] ;
44
+ const id = match[0 ].replace ( " # " , " " ) ;
41
45
GetChapterDetail (id).then ((res ) => {
42
46
this .$emit (" on-chapter-click" , res .result )
43
47
});
You can’t perform that action at this time.
0 commit comments