mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-15 04:41:25 +08:00
优化关键词显示
This commit is contained in:
@@ -4,12 +4,18 @@ Vue.component("keyword", {
|
|||||||
let word = this.vWord
|
let word = this.vWord
|
||||||
if (word == null) {
|
if (word == null) {
|
||||||
word = ""
|
word = ""
|
||||||
|
} else {
|
||||||
|
word = word.replace(/\)/, "\\)")
|
||||||
|
word = word.replace(/\(/, "\\(")
|
||||||
|
word = word.replace(/\+/, "\\+")
|
||||||
|
word = word.replace(/\^/, "\\^")
|
||||||
|
word = word.replace(/\$/, "\\$")
|
||||||
}
|
}
|
||||||
|
|
||||||
let slot = this.$slots["default"][0]
|
let slot = this.$slots["default"][0]
|
||||||
let text = slot.text
|
let text = slot.text
|
||||||
if (word.length > 0) {
|
if (word.length > 0) {
|
||||||
text = text.replace(new RegExp(word, "g"), "<span style=\"border: 1px #ccc dashed; color: #ef4d58\">" + word + "</span>")
|
text = text.replace(new RegExp("(" + word + ")", "ig"), "<span style=\"border: 1px #ccc dashed; color: #ef4d58\">$1</span>")
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user