diff --git a/src/main.js b/src/main.js index bcce2de..3b4dfca 100644 --- a/src/main.js +++ b/src/main.js @@ -7,4 +7,16 @@ import './assets/main.css' const app = createApp(App) app.use(router) -app.mount('#app') \ No newline at end of file +app.mount('#app') + +// 检测小程序环境并注入全局方法 +if (typeof wx !== 'undefined') { + // 尝试加载小程序 JSSDK + const script = document.createElement('script'); + script.src = 'https://res.wx.qq.com/open/js/jweixin-1.6.0.js'; + script.onload = () => { + console.log('小程序 JSSDK 加载成功'); + // 可以在这里初始化一些全局配置 + }; + document.head.appendChild(script); + } \ No newline at end of file