正则表达式填写多行时提示用户需要转换成竖杠(|)符号

This commit is contained in:
GoEdgeLab
2023-05-27 14:44:39 +08:00
parent c2ff1ffc0c
commit 27d63a6c03
6 changed files with 20 additions and 4 deletions

View File

@@ -589,7 +589,7 @@ body.expanded .main {
width: 4px; width: 4px;
} }
.main .tab-menu { .main .tab-menu {
margin-top: 0.5em !important; margin-top: 0 !important;
margin-bottom: 0 !important; margin-bottom: 0 !important;
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; overflow-y: hidden;

File diff suppressed because one or more lines are too long

View File

@@ -106,7 +106,7 @@
<!-- 右侧主操作栏 --> <!-- 右侧主操作栏 -->
<div class="main" :class="{'without-menu':teaSubMenus.menus == null || teaSubMenus.menus.length == 0 || (teaSubMenus.menus.length == 1 && teaSubMenus.menus[0].alwaysActive), 'without-secondary-menu':teaSubMenus.alwaysMenu == null || teaSubMenus.alwaysMenu.items.length <= 1, 'without-footer':!teaShowOpenSourceInfo}" v-cloak=""> <div class="main" :class="{'without-menu':teaSubMenus.menus == null || teaSubMenus.menus.length == 0 || (teaSubMenus.menus.length == 1 && teaSubMenus.menus[0].alwaysActive), 'without-secondary-menu':teaSubMenus.alwaysMenu == null || teaSubMenus.alwaysMenu.items.length <= 1, 'without-footer':!teaShowOpenSourceInfo}" v-cloak="">
<!-- 操作菜单 --> <!-- 操作菜单 -->
<div class="ui top menu tabular tab-menu small" v-if="teaTabbar.length > 0"> <div class="ui top menu tabular tab-menu small" v-if="teaTabbar.length > 1">
<a class="item" v-for="item in teaTabbar" :class="{'active':item.active, right:item.right, title: item.isTitle, icon: item.icon != null && item.icon.length > 0}" :href="item.url"> <a class="item" v-for="item in teaTabbar" :class="{'active':item.active, right:item.right, title: item.isTitle, icon: item.icon != null && item.icon.length > 0}" :href="item.url">
<var>{{item.name}}<span v-if="item.subName.length > 0">({{item.subName}})</span><i class="icon small" :class="item.icon" v-if="item.icon != null && item.icon.length > 0"></i> </var> <var>{{item.name}}<span v-if="item.subName.length > 0">({{item.subName}})</span><i class="icon small" :class="item.icon" v-if="item.icon != null && item.icon.length > 0"></i> </var>
<div class="bottom-indicator" v-if="item.active && !item.isTitle"></div> <div class="bottom-indicator" v-if="item.active && !item.isTitle"></div>

View File

@@ -578,7 +578,7 @@ body.expanded .main {
.main { .main {
.tab-menu { .tab-menu {
margin-top: 0.5em !important; margin-top: 0 !important;
margin-bottom: 0 !important; margin-bottom: 0 !important;
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; overflow-y: hidden;

View File

@@ -116,6 +116,7 @@
<!-- 其余数据 --> <!-- 其余数据 -->
<textarea rows="3" maxlength="4096" name="value" v-model="rule.value" @input="changeRuleValue" v-else></textarea> <textarea rows="3" maxlength="4096" name="value" v-model="rule.value" @input="changeRuleValue" v-else></textarea>
<p class="comment" v-if="(rule.operator == 'match' || rule.operator == 'not match') && rule.value.match(/\n/)"><span class="red">警告:发现你填写的正则表达式中包含了换行符,如果你的意图是每行都表示不同的选项,那么请使用竖杠(<code-label>|</code-label>)符号代替换行符,比如把<code-label>a换行b换行c换行</code-label>改成<code-label>a|b|c</code-label><a href="" @click.prevent="convertValueLine">[帮我转换]</a></span></p>
<!-- 特殊规则 --> <!-- 特殊规则 -->
<div style="margin-top: 1em"> <div style="margin-top: 1em">

View File

@@ -122,6 +122,21 @@ Tea.context(function () {
} }
} }
this.convertValueLine = function () {
let value = this.rule.value
if (value != null && value.length > 0) {
let lines = value.split(/\n/)
let resultLines = []
lines.forEach(function (line) {
line = line.trim()
if (line.length > 0) {
resultLines.push(line)
}
})
this.rule.value = resultLines.join("|")
}
}
/** /**
* 正则测试 * 正则测试
*/ */