|
@@ -4,14 +4,9 @@ import router from './router'
|
|
|
import store from './store'
|
|
|
|
|
|
import 'lib-flexible'
|
|
|
-
|
|
|
+import './assets/fonts/iconfont.css';
|
|
|
Vue.config.productionTip = false
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
import VConsole from 'vconsole'
|
|
|
|
|
@@ -22,19 +17,12 @@ if (process.env.NODE_ENV === 'production' && process.env.VUE_APP_RealEnv !== 'pr
|
|
|
|
|
|
}
|
|
|
const ua = navigator.userAgent
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- 即 阿里云的正常环境(http:
|
|
|
- 使用deviceready
|
|
|
-*/
|
|
|
-if (process.env.NODE_ENV === 'production' && !['alyTest', 'test'].includes(process.env.VUE_APP_RealEnv)) {
|
|
|
+
|
|
|
+let flag = false
|
|
|
+
|
|
|
+if (process.env.NODE_ENV === 'production' && ua.match(/(iPhone | Android)/)) {
|
|
|
window.addEventListener('deviceready', function() {
|
|
|
+ flag = true
|
|
|
new Vue({
|
|
|
router,
|
|
|
store,
|
|
@@ -42,13 +30,34 @@ if (process.env.NODE_ENV === 'production' && !['alyTest', 'test'].includes(proce
|
|
|
}).$mount('#app')
|
|
|
})
|
|
|
} else {
|
|
|
-
|
|
|
+ flag = true
|
|
|
new Vue({
|
|
|
router,
|
|
|
store,
|
|
|
render: (h) => h(App),
|
|
|
}).$mount('#app')
|
|
|
}
|
|
|
+
|
|
|
+setTimeout(() => {
|
|
|
+ if (flag) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const myEvent = new CustomEvent('deviceready', {
|
|
|
+ detail: {
|
|
|
+ title: 'This is deviceready!',
|
|
|
+ },
|
|
|
+ })
|
|
|
+ window.addEventListener('deviceready', function(event) {
|
|
|
+ console.log('deviceready success')
|
|
|
+ })
|
|
|
+
|
|
|
+ if (window.dispatchEvent) {
|
|
|
+ window.dispatchEvent(myEvent)
|
|
|
+ } else {
|
|
|
+ window.fireEvent(myEvent)
|
|
|
+ }
|
|
|
+}, 2000)
|
|
|
+
|
|
|
|
|
|
|
|
|
|