1234567891011121314151617181920212223242526 |
- import Vue from 'vue'
- import { isWeiXinBrowser } from '@/utils/globalFunctions.ts'
- import { getWxSdkSign } from '@/api/pay.ts'
- declare module 'vue/types/vue' {
- interface Vue {
- $env: any;
- $getWxSdkSign: any;
- }
- }
- const inWeiXinBrowser = isWeiXinBrowser()
- // 全局变量
- Vue.prototype.$env = {
- isWeiXinBrowser: inWeiXinBrowser,
- platform: inWeiXinBrowser ? 'wx' : 'app'
- }
- // 如果是微信浏览器,全局初始化一个微信SDK
- if (inWeiXinBrowser) {
- // Vue.prototype.$getWxSdkSign = getWxSdkSign
- // getWxSdkSign({ url: location.href.split('#')[0] }).then(res => {
- // console.log(res)
- // })
- }
|