mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-09 08:40:26 +08:00
UA名单支持批量添加关键词
This commit is contained in:
@@ -19,7 +19,8 @@ Vue.component("user-agent-config-box", {
|
|||||||
keywords: [],
|
keywords: [],
|
||||||
action: "deny"
|
action: "deny"
|
||||||
},
|
},
|
||||||
moreOptionsVisible: false
|
moreOptionsVisible: false,
|
||||||
|
batchKeywords: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -34,6 +35,10 @@ Vue.component("user-agent-config-box", {
|
|||||||
},
|
},
|
||||||
add: function () {
|
add: function () {
|
||||||
this.isAdding = true
|
this.isAdding = true
|
||||||
|
let that = this
|
||||||
|
setTimeout(function () {
|
||||||
|
that.$refs.batchKeywords.focus()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
confirm: function () {
|
confirm: function () {
|
||||||
if (this.addingFilter.action == "deny") {
|
if (this.addingFilter.action == "deny") {
|
||||||
@@ -61,9 +66,18 @@ Vue.component("user-agent-config-box", {
|
|||||||
keywords: [],
|
keywords: [],
|
||||||
action: "deny"
|
action: "deny"
|
||||||
}
|
}
|
||||||
|
this.batchKeywords = ""
|
||||||
},
|
},
|
||||||
changeKeywords: function (keywords) {
|
changeKeywords: function (keywords) {
|
||||||
this.addingFilter.keywords = keywords
|
let arr = keywords.split(/\n/)
|
||||||
|
let resultKeywords = []
|
||||||
|
arr.forEach(function (keyword){
|
||||||
|
keyword = keyword.trim()
|
||||||
|
if (!resultKeywords.$contains(keyword)) {
|
||||||
|
resultKeywords.push(keyword)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.addingFilter.keywords = resultKeywords
|
||||||
},
|
},
|
||||||
showMoreOptions: function () {
|
showMoreOptions: function () {
|
||||||
this.moreOptionsVisible = !this.moreOptionsVisible
|
this.moreOptionsVisible = !this.moreOptionsVisible
|
||||||
@@ -119,8 +133,8 @@ Vue.component("user-agent-config-box", {
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="title">UA关键词</td>
|
<td class="title">UA关键词</td>
|
||||||
<td>
|
<td>
|
||||||
<values-box :v-values="addingFilter.keywords" :v-allow-empty="true" @change="changeKeywords"></values-box>
|
<textarea v-model="batchKeywords" @input="changeKeywords(batchKeywords)" ref="batchKeywords" style="width: 20em" placeholder="*浏览器标识*"></textarea>
|
||||||
<p class="comment">不区分大小写,比如<code-label>Chrome</code-label>;支持<code-label>*</code-label>通配符,比如<code-label>*Firefox*</code-label>;也支持空的关键词,表示空UserAgent。</p>
|
<p class="comment">每行一个关键词;不区分大小写,比如<code-label>Chrome</code-label>;支持<code-label>*</code-label>通配符,比如<code-label>*Firefox*</code-label>;也支持空行关键词,表示空UserAgent。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user