浏览代码

fix: 事件绑定修改

cuiyalong 4 年之前
父节点
当前提交
014196d43d
共有 1 个文件被更改,包括 6 次插入7 次删除
  1. 6 7
      src/views/main/ReportDetail.vue

+ 6 - 7
src/views/main/ReportDetail.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="report-detail">
     <!-- 骨架屏 -->
-    <div class="skeleton" v-if="skeletonShow">
+    <div class="skeleton" v-show="skeletonShow">
       <div class="skeleton-main">
         <div style="padding:20px 0">
           <van-skeleton :row="2" />
@@ -22,7 +22,7 @@
       </div>
     </div>
     <!-- 内容 -->
-    <div class="content" v-else>
+    <div class="content" v-show="!skeletonShow">
       <div class="c-main">
         <div class="top">
           <div class="title">{{detail.title}}</div>
@@ -42,7 +42,9 @@
       <div class="j-footer" ref="footer">
         <div class="j-button-group">
           <!-- <button class="j-button-confirm" data-need-bind-phone @click="goBuy(detail.id)">立即购买</button> -->
-          <button class="j-button-confirm" data-need-bind-phone>立即购买</button>
+          <div class="button-container j-button-confirm" @click="goBuy(detail.id)">
+            <button class="j-button-confirm" data-need-bind-phone>立即购买</button>
+          </div>
         </div>
       </div>
     </div>
@@ -52,7 +54,6 @@
 import { Component, Vue } from 'vue-property-decorator'
 import { mapMutations, mapActions } from 'vuex'
 import { Skeleton } from 'vant'
-declare const $: any
 
 @Component({
   name: 'detail',
@@ -114,16 +115,14 @@ export default class Home extends Vue {
 
   mounted () {
     // 清除购买页面用户填写的信息
+    this.loadScript(this.injectBindPhoneScript[this.$env.platform])
     this.clearBuyState()
     this.getDetail(`id=${this.$route.params.id}`).then((res: any) => {
       if (res.error_code === 0 && res.data) {
         this.detail = res.data
         this.skeletonShow = false
-        this.$nextTick(() => this.loadScript(this.injectBindPhoneScript[this.$env.platform]))
       }
     })
-
-    $('.j-button-confirm').on('click', () => this.goBuy(this.detail.id))
   }
 
   goBuy (id) {