h5.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view>
  3. <web-view :src="href"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. href: ""
  11. };
  12. },
  13. onLoad(option) {
  14. if (option.url == 'jinjiaqu_pingce') {
  15. this.href = 'http://anstatic.nxmy.com:8011/assets/html/pingce/?mine_code=jinjiaqu&token=' + uni
  16. .getStorageSync('Authorization') + '#/'
  17. }
  18. if (option.url == 'https://xw.tianqi.qq.com/') {
  19. this.href = 'https://xw.tianqi.qq.com/'
  20. } {
  21. this.href = option.url + "?token=" + uni.getStorageSync('Authorization')
  22. console.log(this.href)
  23. }
  24. //#ifdef H5
  25. // if(this.href.indexOf('https://mp.weixin.qq.com') != -1){
  26. // window.location.href = this.href;
  27. // }
  28. //#endif
  29. },
  30. onReady() {
  31. // #ifdef APP-PLUS
  32. var currentWebview = this.$scope.$getAppWebview().children()[0];
  33. //监听注入的js
  34. currentWebview.addEventListener("loaded", function() {
  35. currentWebview.evalJS(
  36. "mui.init({keyEventBind: {backbutton: false }});"
  37. );
  38. });
  39. // #endif
  40. }
  41. }
  42. </script>
  43. <style lang="scss">
  44. </style>