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 {
5252 });
5353 },
5454 saveContent (value , render ) {
55+ /**
56+ * 备注:因为mavonEditor在把md转换为html时会自动给链接加上target="_blank",但如果链接本身href是以#开头,则忽略
57+ * 所以,如果需要在文章内部继续做链接跳转其他内置文章,可以把href设置为#id的形式
58+ */
5559 SaveChapter ({
5660 id: this .$route .query .id ,
5761 content: value,
Original file line number Diff line number Diff line change @@ -35,9 +35,13 @@ export default {
3535 handleAnchor (e ) {
3636 // 文章内部链接跳转处理
3737 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
3943 if (match && match[0 ]) {
40- const id = match[0 ].match ( / \d + / g )[ 0 ] ;
44+ const id = match[0 ].replace ( " # " , " " ) ;
4145 GetChapterDetail (id).then ((res ) => {
4246 this .$emit (" on-chapter-click" , res .result )
4347 });
You can’t perform that action at this time.
0 commit comments