Commit d2e526cb by 展昭

修改main.js用于测试jsbridge 03

parent c5111d9b
Showing with 49 additions and 49 deletions
import Vue from 'vue' // import Vue from 'vue'
import App from './App.vue' // import App from './App.vue'
import router from './router' // import router from './router'
import store from './store' // import store from './store'
import 'lib-flexible/flexible' // import 'lib-flexible/flexible'
import './assets/css/index.css' // import './assets/css/index.css'
import './utils/filter' // import './utils/filter'
import FastClick from 'fastclick' // import FastClick from 'fastclick'
// import initJsBridge from "./assets/js/JsBridge"; // // import initJsBridge from "./assets/js/JsBridge";
import bridge from "./assets/js/bridge/birdge"; // import bridge from "./assets/js/bridge/birdge";
Vue.config.productionTip = false // Vue.config.productionTip = false
Vue.prototype.globalNavLeftArrowClick = function (callback) { // Vue.prototype.globalNavLeftArrowClick = function (callback) {
document.getElementsByClassName("van-nav-bar__left")[0].onclick = function () { // document.getElementsByClassName("van-nav-bar__left")[0].onclick = function () {
callback(); // callback();
}; // };
}; // };
FastClick.attach(document.body); // FastClick.attach(document.body);
FastClick.prototype.focus = function (targetElement) { // FastClick.prototype.focus = function (targetElement) {
let length; // let length;
if (targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') { // if (targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') {
length = targetElement.value.length; // length = targetElement.value.length;
targetElement.focus(); // targetElement.focus();
targetElement.setSelectionRange(length, length); // targetElement.setSelectionRange(length, length);
} else { // } else {
targetElement.focus(); // targetElement.focus();
} // }
}; // };
Vue.prototype.setPageNavState = function () { // Vue.prototype.setPageNavState = function () {
bridge.setPageNavState({ // bridge.setPageNavState({
isShowClose: false, // isShowClose: false,
isShowBack: false, // isShowBack: false,
isCloseLeft: false, // isCloseLeft: false,
isShowTitle: false, // isShowTitle: false,
isShowNav: false, // isShowNav: false,
isCloseWebView: false // isCloseWebView: false
}); // });
bridge.getBarHeight().then(response => { // bridge.getBarHeight().then(response => {
response = JSON.parse(response); // response = JSON.parse(response);
const barHeight = response.statusBarHeight; // const barHeight = response.statusBarHeight;
localStorage.setItem("barHeight", barHeight); // localStorage.setItem("barHeight", barHeight);
console.log('main barHeight=', barHeight); // console.log('main barHeight=', barHeight);
}) // })
bridge.setBarColor({ "barColor": "#0978e7" }); // bridge.setBarColor({ "barColor": "#0978e7" });
}; // };
Vue.prototype.$bridge = bridge; // Vue.prototype.$bridge = bridge;
if (process.env.NODE_ENV === 'development'||process.env.NODE_ENV === 'staging') { // if (process.env.NODE_ENV === 'development'||process.env.NODE_ENV === 'staging') {
const VConsole = require('vconsole') // const VConsole = require('vconsole')
const my_console = new VConsole(); // const my_console = new VConsole();
} // }
// new Vue({ // new Vue({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment