This commit is contained in:
aaron 2025-03-04 12:04:43 +08:00
parent ce3fed4040
commit 650c3969ac

View File

@ -7,4 +7,16 @@ import './assets/main.css'
const app = createApp(App) const app = createApp(App)
app.use(router) app.use(router)
app.mount('#app') 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);
}