我可以操纵我的Vue的typescript流吗?js app?

yftpprvb  于 2023-05-01  发布在  Vue.js
关注(0)|答案(1)|浏览(112)

我想把我的主机装满。tsfile并在它完全加载后,初始化我正在使用的其他文件作为 singleton
使用console.log()时,我注意到我的singletonExample。ts文件在main之前运行。ts,我可以操纵流使main。ts*在任何其他ts或js文件 * 之前运行?
我的示例文件包含typescript类
代码示例

main.ts

console.log('main');

singletonExample.ts

console.log("single");

//控制台结果

single
main
imzjd6km

imzjd6km1#

singletonExample.ts导入main.ts作为其第一行

// singletonExample.ts
import 'main.ts'

那么main.ts总是在singletonExample.ts之前执行

相关问题