vue--子组件修改数据传递给父组件

子组件代码:
{{desc.all}}{{ratings.length}}
只看有内容的评价

methods: {
    select (type, event) {
      if (!event._constructed) {
        return
      }
      this.$emit('select', type)
    },
    toggleContent (event) {
      if (!event._constructed) {
        return
      }
      this.$emit('toggle')
    }
  }

父组件代码:

methods: {
  selectRating (type) {
      this.selectType = type
      this.$nextTick(() => {
        this.scroll.refresh()//实时更新better-scroll的高度,$nextTick异步更新dom
      })
    },
    toggleContent () {
      this.onlyContent = !this.onlyContent
      this.$nextTick(() => {
        this.scroll.refresh()//实时更新better-scroll的高度,$nextTick异步更新dom
      })
    }
}


你可能感兴趣的:(vue2.0)