Przeglądaj źródła

www/protected/modules/j/views/web/giftPackage.php

seamong 7 lat temu
rodzic
commit
0cce7f795f

+ 6 - 6
www/protected/modules/j/views/web/giftPackage.php

@@ -21,10 +21,10 @@
     </div>
     <div class=container>
       <div class=items v-for='(item,index) in imgs' :key='index'>
-        <div class=title @click='btnShow(item.name,item.index)' ref='gift'>{{item.name}}</div>
+        <div class=title @click='btnShow(item.name)' ref='gift'>{{item.name}}</div>
         <transition name=fade>
           <div class=images v-if="item.name == nameShow">
-            <img v-for="images in item.urls" :src=images>
+            <img @load="imageLoaded(item.index)" v-for="images in item.urls" :src=images>
           </div>
         </transition>
       </div>
@@ -71,12 +71,12 @@
         // this.btnShow(this.imgs.chicken.name)
       },
       methods: {
-        btnShow(_,index) {
-          console.log(index)
-          // console.log(this.$refs.gift[index].offsetTop);
-          window.scrollTo(0, 58 * index);
+        btnShow(_) {
           this.nameShow = this.oldNameShow == _ ? "" : _, this.oldNameShow = this.oldNameShow == _ ? "" : _
         },
+        imageLoaded(index) {
+          window.scrollTo(0, 58 * index);
+        },
         back() {
           location.href = "http://common.yiguanjia.me/index.php?r=j/web/index"
         },