Browse Source

fix: 修复小程序demo预览在其他多端平台的样式问题

suzigang 4 years ago
parent
commit
16790216b5

+ 2 - 4
src/packages/__VUE/elevator/index.scss

@@ -3,8 +3,10 @@
   display: block;
   display: block;
   position: relative;
   position: relative;
   &__list {
   &__list {
+    display: block;
     overflow: auto;
     overflow: auto;
     &__item {
     &__item {
+      display: block;
       font-size: 12px;
       font-size: 12px;
       color: #333;
       color: #333;
       &__code {
       &__code {
@@ -66,7 +68,3 @@
     }
     }
   }
   }
 }
 }
-
-view {
-  display: block;
-}

+ 8 - 6
src/packages/__VUE/elevator/index.taro.vue

@@ -23,9 +23,9 @@
         ></view>
         ></view>
       </view>
       </view>
     </scroll-view>
     </scroll-view>
-    <view class="nut-elevator__code--current" v-show="scrollStart" v-if="indexList.length">{{
-      indexList[currentIndex][acceptKey]
-    }}</view>
+    <view class="nut-elevator__code--current" v-show="scrollStart" v-if="indexList.length">
+      {{ indexList[currentIndex][acceptKey] }}
+    </view>
     <view class="nut-elevator__bars" @touchstart="touchStart" @touchmove.stop.prevent="touchMove" @touchend="touchEnd">
     <view class="nut-elevator__bars" @touchstart="touchStart" @touchmove.stop.prevent="touchMove" @touchend="touchEnd">
       <view class="nut-elevator__bars__inner">
       <view class="nut-elevator__bars__inner">
         <view
         <view
@@ -179,11 +179,13 @@ export default create({
     };
     };
 
 
     onMounted(() => {
     onMounted(() => {
-      setTimeout(() => {
-        Taro.nextTick(() => {
+      if (Taro.getEnv() === 'WEB') {
+        calculateHeight();
+      } else {
+        eventCenter.once((getCurrentInstance() as any).router.onReady, () => {
           calculateHeight();
           calculateHeight();
         });
         });
-      }, 300);
+      }
     });
     });
 
 
     return {
     return {

+ 3 - 1
src/sites/mobile-taro/vue/project.config.json

@@ -32,5 +32,7 @@
   "simulatorType": "wechat",
   "simulatorType": "wechat",
   "simulatorPluginLibVersion": {},
   "simulatorPluginLibVersion": {},
   "libVersion": "2.17.3",
   "libVersion": "2.17.3",
-  "condition": {}
+  "condition": {
+    "miniprogram": {}
+  }
 }
 }

+ 3 - 0
src/sites/mobile-taro/vue/src/base/pages/avatar/index.vue

@@ -63,4 +63,7 @@ export default {
 .demo-avatar {
 .demo-avatar {
   color: #fff;
   color: #fff;
 }
 }
+.nut-avatar {
+  margin-right: 24px;
+}
 </style>
 </style>