|
@@ -7,6 +7,7 @@ import store from './store'
|
|
|
import vueParticles from 'vue-particles'
|
|
|
import Vcomp from './components/index'
|
|
|
import Toast from './components/toast'
|
|
|
+import util from '@/util/index.js'
|
|
|
|
|
|
import '@/assets/styles/base.scss'
|
|
|
import '@/assets/styles/common.scss'
|
|
@@ -21,6 +22,7 @@ Vue.use(Vcomp)
|
|
|
Vue.config.productionTip = false
|
|
|
|
|
|
Vue.prototype.$Toast = Toast
|
|
|
+Vue.prototype.$util = util
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
if (to.meta.title) {
|
|
@@ -33,27 +35,4 @@ window.$this = new Vue({
|
|
|
router,
|
|
|
store,
|
|
|
render: (h) => h(App),
|
|
|
- beforeCreate() {
|
|
|
- Vue.prototype.$bus = this
|
|
|
- Vue.prototype.$apiObj = http.apiObj
|
|
|
- Object.entries(http.apiObj).forEach(([key, item]) => {
|
|
|
- const fn = () => {
|
|
|
- if (typeof item.api === `string`) {
|
|
|
- this.$http
|
|
|
- .get(item.api, {
|
|
|
- params: item.arg,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- this.$bus.$emit(key, res, item.arg)
|
|
|
- })
|
|
|
- } else {
|
|
|
- item.api(item.arg).then((res) => {
|
|
|
- this.$bus.$emit(key, res, item.arg)
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- fn()
|
|
|
- setInterval(fn, item.time)
|
|
|
- })
|
|
|
- },
|
|
|
}).$mount(`#app`)
|