1
This commit is contained in:
@@ -20,13 +20,30 @@ export default class uiTool {
|
||||
*/
|
||||
static getComponent(componentPath) {
|
||||
if (!componentPath) return null
|
||||
|
||||
|
||||
// 标准化路径(移除 .vue 后缀)
|
||||
const normalizedPath = componentPath.replace(/\.vue$/, '')
|
||||
|
||||
|
||||
// 从映射表中查找
|
||||
return componentMap[normalizedPath] || componentMap[componentPath]
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件下载工具
|
||||
* @param {Object|Blob} res - 响应数据或Blob对象
|
||||
* @param {String} fileName - 文件名(可选,默认为时间戳.csv)
|
||||
*/
|
||||
static downloadFile(res, fileName) {
|
||||
const blob = new Blob([res.data || res])
|
||||
const downloadElement = document.createElement('a')
|
||||
const href = window.URL.createObjectURL(blob)
|
||||
downloadElement.href = href
|
||||
downloadElement.download = fileName || new Date().getTime() + '.csv'
|
||||
document.body.appendChild(downloadElement)
|
||||
downloadElement.click()
|
||||
document.body.removeChild(downloadElement)
|
||||
window.URL.revokeObjectURL(href)
|
||||
}
|
||||
static setRem() {
|
||||
let whdef = 100 / 1920
|
||||
let bodyWidth = document.body.clientWidth
|
||||
|
||||
Reference in New Issue
Block a user