2018-08-09 09:52:52 +08:00
|
|
|
import log from './util.log.js'
|
|
|
|
|
import cookies from './util.cookies.js'
|
2018-07-16 22:22:55 +08:00
|
|
|
|
2018-07-24 11:02:51 +08:00
|
|
|
let util = {
|
2018-08-09 09:52:52 +08:00
|
|
|
cookies,
|
|
|
|
|
log
|
2018-07-16 22:22:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description 更新标题
|
2018-07-22 20:34:36 +08:00
|
|
|
* @param {String} title 标题
|
2018-07-16 22:22:55 +08:00
|
|
|
*/
|
2018-07-17 23:59:20 +08:00
|
|
|
util.title = function (titleText) {
|
2018-08-21 23:25:57 +08:00
|
|
|
const processTitle = process.env.VUE_APP_TITLE || 'D2Admin'
|
|
|
|
|
window.document.title = `${processTitle}${titleText ? ` | ${titleText}` : ''}`
|
2018-07-16 22:22:55 +08:00
|
|
|
}
|
|
|
|
|
|
2018-08-13 00:25:55 +08:00
|
|
|
/**
|
|
|
|
|
* @description 打开新页面
|
|
|
|
|
* @param {String} url 地址
|
|
|
|
|
*/
|
|
|
|
|
util.open = function (url) {
|
|
|
|
|
var a = document.createElement('a')
|
|
|
|
|
a.setAttribute('href', url)
|
|
|
|
|
a.setAttribute('target', '_blank')
|
|
|
|
|
a.setAttribute('id', 'd2admin-menu-link')
|
|
|
|
|
document.body.appendChild(a)
|
|
|
|
|
a.click()
|
|
|
|
|
document.body.removeChild(document.getElementById('d2admin-menu-link'))
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-16 22:22:55 +08:00
|
|
|
export default util
|