From 4c48ac02a1ca5d5f2dafe07d186dfadafde148a6 Mon Sep 17 00:00:00 2001 From: laozt <2721205210@qq.com> Date: Wed, 17 Jan 2024 15:40:34 +0800 Subject: [PATCH] vconsloe --- package.json | 1 + src/App.vue | 34 +++------------------------------- src/main.js | 8 ++++++-- 3 files changed, 10 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index d5d6703..690ece3 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "leaflet": "^1.5.1", "moment": "^2.24.0", "vant": "^2.0.3", + "vconsole": "^3.15.1", "vue": "^2.6.10", "vue-cropper": "^0.4.9", "vue-router": "^3.0.3", diff --git a/src/App.vue b/src/App.vue index f01ef65..e405dc1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -20,39 +20,11 @@ export default { data() { return { bac: 'transparent', - h: 20 + h: 20, } }, created() { - // let token = localStorage.getItem('lj_token'); - // if (token) this.$router.replace('/home'); let _this = this - - // 手机打包版本 - let h = window.plus.navigator.getStatusbarHeight() // 获取状态栏高度 - this.config.setBarHeight(h) - localStorage.setItem('mudu_bar', h) - var first = null - window.plus.key.addEventListener( - 'backbutton', - function() { - if (!first) { - first = new Date().getTime() // 记录第一次按下回退键的时间 - // _this.$toast({ message: '再按一次退出应用', position: 'bottom' }) // 给出提示 - history.go(-1) // 回退到上一页面 - setTimeout(function() { - // 1s中后清除 - first = null - }, 1000) - } else { - if (new Date().getTime() - first < 1000) { - // 如果两次按下的时间小于1s, - window.plus.runtime.quit() // 那么就退出app - } - } - }, - false - ) }, mounted() { // rem计算方法:设计图px/36 @@ -63,8 +35,8 @@ export default { $route(val) { // 切换页面后,滚动条恢复到顶部 window.scroll(0, 0) - } - } + }, + }, } diff --git a/src/main.js b/src/main.js index b543eba..0cbf61d 100644 --- a/src/main.js +++ b/src/main.js @@ -14,6 +14,7 @@ import '@vant/touch-emulator' import 'vant/lib/index.css' import './assets/css/vant-ui.scss' import './assets/css/style.css' +import VConsole from 'vconsole' import moment from 'moment' import 'moment/locale/zh-cn' @@ -27,17 +28,20 @@ Vue.config.productionTip = false moment.locale('zh-cn') Vue.prototype.$moment = moment +const vConsole = new VConsole({ theme: 'dark' }) +Vue.use(vConsole) + Vue.prototype.config = { barHeight: 20, setBarHeight(h) { this.barHeight = h - } + }, } // PC调式版本 new Vue({ router, - render: h => h(App) + render: (h) => h(App), }).$mount('#app') // 手机打包版本