【发布时间】:2020-11-06 12:55:02
【问题描述】:
如何对我的 Vue 组件数据使用对象解构? 这是我的实际代码:
data: () => ({
descricao: '',
perfilBase: null,
anotherField: '',
otherOne: false
}),
mounted () {
this.descricao = this.$route.query.descricao
this.perfilBase = this.$route.query.perfilBase
}
我怎么能这样呢?有可能吗?
mounted () {
{ this.descricao, this.perfilBase } = ...this.$route.query
}
【问题讨论】:
-
尝试去掉this前面的'...'。$route.query
标签: javascript vue.js ecmascript-6 destructuring