ningMeiXinXiPingTai.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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() {
  14. // #ifndef APP-NVUE
  15. const eventChannel = this.getOpenerEventChannel();
  16. // #endif
  17. // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
  18. eventChannel.on('acceptDataFromOpenerPage', (data) => {
  19. console.log(data.data)
  20. let link = data.data.link
  21. let token = uni.getStorageSync('ningmei_token')
  22. let appid = data.data.app_id
  23. this.href = link + '?timestamp=' + Date.now() + '&token=' + token + '&appid=' + appid
  24. })
  25. },
  26. onReady() {
  27. setTimeout(()=>{
  28. this.clearMuiBack()
  29. },3000)
  30. },
  31. methods: {
  32. // 关闭mui返回
  33. clearMuiBack() {
  34. // #ifdef APP-PLUS
  35. let currentWebview = this.$scope.$getAppWebview().children()[0]
  36. //监听注入的js
  37. currentWebview.addEventListener("loaded", function() {
  38. currentWebview.evalJS("mui.init({keyEventBind: {backbutton: false }});");
  39. });
  40. // #endif
  41. },
  42. },
  43. }
  44. </script>
  45. <style lang="scss">
  46. </style>