Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
liangzhen
/
framework-tools-web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 72a9cef6
authored
Feb 28, 2024
by
xiehao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、修改了架构元模型结构化解析地址
1 parent
a94d6da7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
src/directive/index.js
src/directive/index.js
View file @
72a9cef
...
@@ -25,27 +25,27 @@ export default function initDirective(vue) {
...
@@ -25,27 +25,27 @@ export default function initDirective(vue) {
}
}
})
})
vue
.
directive
(
'no-backslash'
,
{
//
vue.directive('no-backslash', {
// bind 钩子函数会在指令绑定到元素时调用
//
// bind 钩子函数会在指令绑定到元素时调用
bind
(
el
,
binding
,
vnode
)
{
//
bind(el, binding, vnode) {
// 绑定 @input 监听方法
//
// 绑定 @input 监听方法
el
.
addEventListener
(
'input'
,
function
(
event
)
{
//
el.addEventListener('input', function (event) {
// 获取输入的值
//
// 获取输入的值
const
value
=
event
.
target
.
value
;
//
const value = event.target.value;
//
// 使用正则表达式检测特殊字(根据需要匹配相应限制字符)
//
// 使用正则表达式检测特殊字(根据需要匹配相应限制字符)
const
regex
=
/
(?:
'
)
|
(?:
--
)
|
(\/\*(?:
.|
[\n\r])
*
?\*\/)
|
(\b(
select|update|and|or|delete|insert|truncate|char|into|substr|ascii|declare|exec|count|master|into|drop|execute
)\b)
/i
;
//
const regex = /(?:')|(?:-- )|(\/\*(?:.|[\n\r])*?\*\/)|(\b(select|update|and|or|delete|insert|truncate|char|into|substr|ascii|declare|exec|count|master|into|drop|execute)\b)/i;
// 如果输入值包含特殊字符,则替换为空格
//
// 如果输入值包含特殊字符,则替换为空格
if
(
regex
.
test
(
value
))
{
//
if (regex.test(value)) {
// 使用 replace 方法替换特殊字为空格
//
// 使用 replace 方法替换特殊字为空格
const
newValue
=
value
.
replace
(
regex
,
' '
);
//
const newValue = value.replace(regex, ' ');
// 将新值设置回输入框
//
// 将新值设置回输入框
event
.
target
.
value
=
newValue
;
//
event.target.value = newValue;
// 触发 @input 事件,使其更新组件中的数据
//
// 触发 @input 事件,使其更新组件中的数据
vnode
.
componentInstance
.
$emit
(
'input'
,
newValue
);
//
vnode.componentInstance.$emit('input', newValue);
}
//
}
});
//
});
},
//
},
});
//
});
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment