【发布时间】:2019-12-31 05:34:54
【问题描述】:
我有一个网址:
http://localhost:8080/Currency?currency=RMB
我想得到货币参数RMB
在:
created(){
this.currencyParam = this.$route.query.currency;
console.log(curr: ${this.currencyParam});
}
我可以在F12 - console 中得到curr: RMB,但在F12 -Vue 中我得到currency:undefined
在我的模板中:
<template v-else>
<gateway
:currency="this.$route.query.currency"
/>
</template>
我得到一个错误:
渲染错误:“TypeError:无法读取在
F12 -Vue和F12 -Vue中找到的未定义属性'$route' 我仍然得到currency:undefined
【问题讨论】:
-
模板中没有
this- 只有$route... -
@Estradiaz 我知道它可以解决,但为什么呢?
-
模板解析器是这样设计的 - 作为 v-on stackoverflow.com/questions/57524110/… 上的示例
-
@Estradiaz 你能帮我解决这个问题吗?stackoverflow.com/questions/57676629/…
标签: vue.js