123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <template>
- <web-view cache="no-cache" :src="webViewSrc" @message="getMSG"></web-view>
- </template>
- <script>
- import {getToken} from '@/libs/auth.js';
- export default {
- data() {
- return {
- webViewSrc:""
- }
- },
- onLoad(options) {
- this.init(options)
- },
- methods: {
- init(options){
- let t=new Date().getTime();
- if(options.type==='scan'){
- let href=`${this.$h5}/scanApp/#/pages/index/index`
- let qrcode=uni.getStorageSync('qrcode')
- qrcode=qrcode.split('?')[1]
- this.webViewSrc=`${href}?token=${getToken()}&${qrcode}&v=${t}`
- uni.setNavigationBarTitle({
- title:"扫码操作"
- })
- }else{
- let other=""
- for(let key in options){
- if(key!=='href'&&key!=='name'){
- other+=`${key}=${options[key]}&`
- }
- }
- this.webViewSrc=`${options.href}?token=${getToken()}&${other}v=${t}`
- uni.setNavigationBarTitle({
- title:`${options.name}`
- })
- }
- },
- getMSG(){
-
- }
- },
- onBackPress(e){
- // console.log(e)
- }
- }
- </script>
|