【发布时间】:2021-01-15 19:02:14
【问题描述】:
我正在使用 apexcharts,我正在创建组件图形并传递另一个视图,我想知道如何通过 $emit 将数据从子组件图形更改为父亲?
我尝试按照文档进行操作,但它不起作用
<div class="col-md-3" v-if="show">
<apexchart
v-bind:chart1="chart1"
ref="chart1"
min-width="300"
height="230"
type="bar"
:options="options"
v-on:update:series="series = $event"
></apexchart>
</div>
export default {
name: "data-graf",
components: {
'apexchart': apexchart
},
props:{
series: {
type: Number
}
},
我将组件传递到这里
<table class="data-table-2" style="min-width: 800px">
<apexchart v-bind:series.sync="series"/>
</table>
axios 数据
this.$axios.get("/Op/Search", {params: {...params, arrayFormat: 'repeat'}})
.then(res => {
this.op = res.data
this.$emit('update:series', op)
})
【问题讨论】:
-
请提供minimal reproducible example。您发布的内容不能用于重现该错误。看起来您正在混合
*.sync语法和@update:*语法。*.sync是@update:*语法的简写(更短的替换)。您要么使用其中一个。文档here. -
这个问题在英语中没有意义,克里斯蒂安。你能改写一下吗?
-
所以如果我声明 series = [ this.data],v-bind:series.sync="series" 是否已经捕获数据?
标签: javascript vue.js quasar-framework apexcharts