feat: 添加 TradingView 相关环境变量和初始化逻辑;重构交易视图组件
This commit is contained in:
61
src/main.ts
61
src/main.ts
@@ -41,28 +41,51 @@ import "./theme/ionic.css";
|
||||
|
||||
useTheme();
|
||||
|
||||
function initTradingView() {
|
||||
const { VITE_TRADINGVIEW_LIBRARY_URL } = useEnv();
|
||||
const promise1 = new Promise((resolve) => {
|
||||
const script = document.createElement("script");
|
||||
script.type = "text/javascript";
|
||||
script.src = `${VITE_TRADINGVIEW_LIBRARY_URL}/charting_library/charting_library.standalone.js`;
|
||||
script.async = true;
|
||||
document.body.appendChild(script);
|
||||
script.onload = () => resolve(true);
|
||||
});
|
||||
const promise2 = new Promise((resolve) => {
|
||||
const script = document.createElement("script");
|
||||
script.type = "text/javascript";
|
||||
script.src = `${VITE_TRADINGVIEW_LIBRARY_URL}/datafeeds/udf/bundle.js`;
|
||||
script.async = true;
|
||||
document.body.appendChild(script);
|
||||
script.onload = () => resolve(true);
|
||||
});
|
||||
return Promise.all([promise1, promise2]);
|
||||
}
|
||||
|
||||
function initApp() {
|
||||
authClient.getSession().then((session) => {
|
||||
const pinia = createPinia();
|
||||
const userStore = useUserStore(pinia);
|
||||
userStore.setToken(session.data?.session.token || "");
|
||||
initTradingView().then(() => {
|
||||
authClient.getSession().then((session) => {
|
||||
const pinia = createPinia();
|
||||
const userStore = useUserStore(pinia);
|
||||
userStore.setToken(session.data?.session.token || "");
|
||||
|
||||
const app = createApp(App)
|
||||
.use(IonicVue, {
|
||||
backButtonText: "返回",
|
||||
mode: "ios",
|
||||
statusTap: true,
|
||||
swipeBackEnabled: true,
|
||||
// rippleEffect: true,
|
||||
// animated: false,
|
||||
})
|
||||
.use(uiComponents)
|
||||
.use(pinia)
|
||||
.use(router)
|
||||
.use(i18n);
|
||||
const app = createApp(App)
|
||||
.use(IonicVue, {
|
||||
backButtonText: "返回",
|
||||
mode: "ios",
|
||||
statusTap: true,
|
||||
swipeBackEnabled: true,
|
||||
// rippleEffect: true,
|
||||
// animated: false,
|
||||
})
|
||||
.use(uiComponents)
|
||||
.use(pinia)
|
||||
.use(router)
|
||||
.use(i18n);
|
||||
|
||||
router.isReady().then(() => {
|
||||
app.mount("#app");
|
||||
router.isReady().then(() => {
|
||||
app.mount("#app");
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user