otb-module
Version:
otb-module是基于现有的element-ui库进行的二次封装,简化组件的各自用法,将所有基础组件归纳于一个表单中, 集成表单组件,另还有增删改查的CRUD组件、预览图片/PDF的preview组件、上传文件的upload组件、分页组件与导出组件等等。 引入组件后以数据驱动组件从而加载Dom,让开发变得更简单,让代码更易维护。
28 lines (25 loc) • 882 B
JavaScript
import { version } from "../../package.json"
import { MessageBox } from "element-ui"
import axios from "axios"
export const update = () => {
const url = `${window.location.origin}${window.location.pathname}`
const hostname = window.location.hostname
if (hostname === 'localhost') return
setInterval(() => {
let params = { n: new Date().getTime() }
axios.get(`${url}version.json`, { params }).then((res) => {
if (res.data.version !== version) {
MessageBox.confirm(`当前系统有新版发布(${res.data.version}),需要更新`, "系统更新", {
showClose: false,
showCancelButton: false,
closeOnClickModal: false,
closeOnPressEscape: false,
closeOnHashChange: false,
confirmButtonText: "更新"
}).then(() => {
location.reload()
})
}
})
}, 30000)
}