Răsfoiți Sursa

feat: 调整小数界面的操作策略

zhupei@smartai.com 1 an în urmă
părinte
comite
4632c6b023
1 a modificat fișierele cu 23 adăugiri și 5 ștergeri
  1. 23 5
      src/views/Xiaoshu.vue

+ 23 - 5
src/views/Xiaoshu.vue

@@ -3,8 +3,16 @@
   <ContentContainer :containerStyle="containerStyle">
     <template v-if="!is_mounted"></template>
 
-    <WujieVue v-if="is_mounted" width="100%" height="100%" name="xiaoshu" :url="xiaoshu_server_url" :sync="false"
-      :props="props" :plugins="plugins"></WujieVue>
+    <WujieVue
+      v-if="is_mounted"
+      width="100%"
+      height="100%"
+      name="xiaoshu"
+      :url="xiaoshu_server_url"
+      :sync="false"
+      :props="props"
+      :plugins="plugins"
+    ></WujieVue>
   </ContentContainer>
   <!-- </LayoutExperience> -->
 </template>
@@ -50,12 +58,14 @@ onMounted(() => {
   /**
    * 插入到小数项目中的脚本
    */
-  const insert_script_str = `
+  const insert_script_before_str = `
     window.WEBSOCKET_BASE_URL = '${xiaoshu_websocket_url}';
     window.ASSETS_BASE_URL = '${xiaoshu_assets_url}';
 
     localStorage.setItem('xintongxiaoshu', '${info_str}');
+  `;
 
+  const insert_script_after_str = `
     const box = document.querySelector('.xiaoshu-aside-left-menus-container');
 
     if(box){
@@ -105,10 +115,18 @@ onMounted(() => {
   plugins.value = [
     {
       /**
+       * 在子应用所有的js之前
        * @see https://wujie-micro.github.io/doc/guide/plugin.html#js-before-loaders
        */
-      // 在子应用所有的js之后
-      jsAfterLoaders: [{ content: insert_script_str }]
+      jsBeforeLoaders: [{ content: insert_script_before_str }]
+    },
+
+    {
+      /**
+       * 在子应用所有的js之后
+       * @see https://wujie-micro.github.io/doc/guide/plugin.html#js-after-loader
+       */
+      jsAfterLoaders: [{ content: insert_script_after_str }]
     },
     {
       cssAfterLoaders: [