[英]How can I open the dialog when clicking the value that has been plot on chart in vue-chartjs
I'm trying to open a v-dialog
when I click a point on a chart. 单击图表上的某个点时,我试图打开
v-dialog
。 I bound the dialog's v-model
to this.dialog
(a data property), but setting this.dialog
to true
doesn't open the dialog. 我将对话框的
v-model
绑定到this.dialog
(数据属性),但是将this.dialog
设置为true
不会打开对话框。 When I check the value of the this.dialog
, it is really true
. 当我检查
this.dialog
的值时,确实是true
。 Why doesn't the dialog open? 为什么对话框没有打开?
<line-chart
:chart-data="datacollection"
:options="optionscollection"
/>
this.optionscollection = {
onClick: function(evt, item) {
this.dialog = true;
}
};
The onClick
handler does not have its context bound properly, so this
is not the Vue component instance there. onClick
处理程序未正确绑定其上下文,因此this
不是 Vue组件实例。 Use an arrow function instead: 改用箭头功能 :
this.optionscollection = {
onClick: (evt, item) => {
this.dialog = true;
}
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.