路由规则增加特殊符号~!@$-=

master
yutent 2023-12-29 09:51:50 +08:00
parent a24ab67694
commit ba92054633
1 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ import { __ROUTER_VIEW__, ROUTE_CALLBACKS } from '../constants.js'
//hash前缀正则
const PREFIX_REGEXP = /^(#!|#)[\/]+?/
const RULE_REGEXP = /(\/[^/]*)(:[A-Za-z0-9_]+)(\?)?/g
const RULE_REGEXP = /(\/[^/]*)(:[\$@~\\!A-Za-z0-9_=\-]+)(\?)?/g
const MODE_HASH = 'hash'
const MODE_HISTORY = 'history'
@ -70,7 +70,7 @@ class Router {
if (_prefix === '/') {
_prefix = '/?'
}
return _prefix + '([A-Za-z0-9_]+)' + _require
return _prefix + '([\\$\\!@~A-Za-z0-9_=\\-]+)' + _require
}
)