// ... const app = createApp(App); // 以绑定 alert 函数为例,alert.bind(this) 可以解决非 window 对象调用 alert() 时产生的 Illegal invocation 问题: app.config.globalProperties.alert = alert.bind(this); // ...