首页 > 解决方案 > 传递参数 NativeScript-Vue

问题描述

我试图传递params到另一条路线Nativescript,但它总是返回我undefined。我正在使用nativescript-vue-navigator

目前在屏幕上我正在调用以下函数

this.$navigator.navigate('/map', { props: { name: 'Rafael Augusto'} } )

在我的地图屏幕上,我试图像这样

export default {
  props: ['name'],
  mounted(){
    console.log(this.name)
  }
}

标签: javascriptvue.jsnativescriptnativescript-vue

解决方案


真的很晚了,但如果其他两个答案不起作用,可能会对其他人有所帮助:

export default {
  props: ['name'],
  data() {
    name: this.name
  }
  mounted(){
    console.log(this.name)
  }
}

推荐阅读