Vux: 2.6.5版本XDialog组件hide-on-blur无法关闭dialog

Created on 20 Oct 2017  ·  7Comments  ·  Source: airyland/vux

版本信息 "vue": "^2.5.2","vux": "^2.6.5",
qq 20171020103055
hide方法没有广播on-hide事件,组件外无法改变更新值

componenx-dialog yet another bad issue

Most helpful comment

v-model="show" 或者 :show.sync="show" 试试。

All 7 comments

官网 demo 并无问题,请给出代码。

官方demo好像还是老版本的,升级以后出现的这个问题。

<template>
  <x-dialog :show="show" :hide-on-blur="true" @on-hide="hideDiscountDialog" class="discount-dialog" v-if="discountSku">
    <p class="station-sale" v-if="discountSku.isAfterSale === 1">
      <i class="tag">站外站点</i>允许车站外上车点上车
    </p>
    <p class="station-sale" v-if="discountSku.isAfterSale === 1">
      <i class="tag">站外售票</i>允许发车后继续售票
    </p>
    <p class="activity" v-for="activityName in discountSku.activityName" v-if="discountSku.activityName">
      <i class="tag">惠</i> {{activityName}}
    </p>
    <p class="coupon" v-for="couponName in discountSku.couponName" v-if="discountSku.couponName">
      <i class="tag">券</i> {{couponName}}
        </p>
  </x-dialog>
</template>
<script>
  import { XDialog } from 'vux'
  export default {
    props:['showDiscount', 'discountSku'],
    components: {
      XDialog,
    },
    data () {
      return {

      }
    },
    computed: {
      show () {
          return this.showDiscount
      }
    },
    mounted () {

    },
    methods:{
      hideDiscountDialog () {
          this.$emit('hideDiscountDialog')
      }
    }
  }
</script>

v-model="show" 或者 :show.sync="show" 试试。

"vue": "^2.5.2", vue是最新版本的,这个要报错

注意到你这是用一个 computed 属性来绑定,这值肯定没法拿来做双向绑定啊。

另外大哥请你一次性说清楚点吧,这个是哪个,取错又是报什么错。

问题就是如果我这个值没办法双向绑定就没办法关闭dialog,例如从父组件传进来的值或者computed计算出来的值,所以需要在dialog关闭的时候触发on-hide去改变这个值

使用 v-model="show"或者 :show.sync="show" 问题完美解决

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chengjs picture chengjs  ·  4Comments

prettybot picture prettybot  ·  3Comments

lkangd picture lkangd  ·  5Comments

skyshirt picture skyshirt  ·  4Comments

GloriaCHL picture GloriaCHL  ·  4Comments