Commit f94049c8 by xinlaa

js sdk 引入与相关配置

1 parent 883311e7
<script>
export default {
name: 'App',
data() {
return {
timestamp: '',
nonceStr: '',
signature: '',
}
},
created() {
// 调取服务端signature
},
watch: {
// 通过config接口注入权限验证配置
// 所有需要使用JS-SDK的页面必须先注入配置信息,否则将无法调用(同一个url仅需调用一次,对于变化url的SPA(single-page application)的web app可在每次url变化时进行调用)
$router() {
wx.config({
beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: '123456', // 必填,企业微信的corpID
timestamp: this.timestamp, // 必填,生成签名的时间戳
nonceStr: this.nonceStr, // 必填,生成签名的随机串
signature: this.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
jsApiList: [], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
})
},
},
}
</script>
<template>
<div id="app">
<div id="nav">
......
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import wx from '@/utils/jweixin-1.2.0.js'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
Vue.config.productionTip = false;
window.wx = wx
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
}).$mount("#app");
render: (h) => h(App),
}).$mount('#app')
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!