【fix ESLint】components/jero、components/layouts、components/tools、utils、views/account/center、views/demo、views/system
This commit is contained in:
@@ -37,8 +37,7 @@ export function filterObj (obj) {
|
||||
}
|
||||
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key) &&
|
||||
(obj[key] == null || obj[key] === undefined || obj[key] === '')) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key) && (obj[key] == null || obj[key] === undefined || obj[key] === '')) {
|
||||
delete obj[key]
|
||||
}
|
||||
}
|
||||
@@ -110,8 +109,7 @@ function generateChildRouters (data) {
|
||||
} else {
|
||||
component = 'views/' + item.component
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
let URL = (item.meta.url|| '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量
|
||||
const URL = (item.meta.url || '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量
|
||||
if (isURL(URL) || (item.meta.url && item.meta.url.indexOf('{{') === 0)) {
|
||||
item.meta.url = URL
|
||||
}
|
||||
@@ -581,7 +579,7 @@ export function isOAuth2AppEnv () {
|
||||
*/
|
||||
export function getReportPrintUrl (url, id, open) {
|
||||
// URL支持{{ window.xxx }}占位符变量
|
||||
url = url.replace(/{{([^}]+)?}}/g, (s1, s2) => eval(s2))
|
||||
url = url.replace(/{{([^}]+)?}}/g, (s1, s2) => evil(s2))
|
||||
if (url.includes('?')) {
|
||||
url += '&'
|
||||
} else {
|
||||
@@ -594,3 +592,13 @@ export function getReportPrintUrl (url, id, open) {
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
||||
/**
|
||||
* 解决eval的eslint问题
|
||||
* @param fn
|
||||
* @returns {*}
|
||||
*/
|
||||
export function evil (fn) {
|
||||
const Fn = Function // 一个变量指向Function,防止有些前端编译工具报错
|
||||
return new Fn('return ' + fn)()
|
||||
}
|
||||
Reference in New Issue
Block a user