使方法成为Vue中数据属性的值

时间:2019-06-26 13:52:34

标签: javascript laravel vue.js vuejs2

我正在使用euvl/vue-js-modal包在VueJs中创建模式。我已将question object传递给模式,并使用@before-open属性接受了它。我可以通过

获得想要的内容
methods: {
  beforeOpen(event) {
    console.log(event.params.question.question_body);
  }
}

我有一个此数据属性

data() {
  return {
    question_body: '',
  }
}

如何从question_body方法中获取beforeOpen作为question_body数据属性的值?

如果我需要进一步解释自己,请告诉我。

谢谢!

1 个答案:

答案 0 :(得分:1)

尝试:

this.question_body = event.params.question.question_body