渲染错误:“ TypeError:无法读取null的属性'PAY_TYPE'”

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了渲染错误:“ TypeError:无法读取null的属性'PAY_TYPE'”相关的知识,希望对你有一定的参考价值。

我想通过使用JSON.parse()从callback_details中显示PAY_TYPE来将字符串转换为对象,但是我尝试并始终将错误作为问题标题。

我的代码:

<td class="text-xs-left">props.item.payment_method<br>(JSON.parse(props.item.callback_details).PAY_TYPE)</td>

data():

data()
return
  loading: false,
  startDate: '',
  endDate: '',
  startMenu: false,
  endMenu: false,
  pagination:
    rowsPerPage: -1
  ,
  orders:[],
  payment:[],
  list1: [],
  list2: [],
  payment_headers:[
     text: this.$translate('merchant'),     value: 'merchant' ,
     text: this.$translate('shop_owner'),    value: 'shop_owner', sortable: false ,
     text: this.$translate('platform_fee'),      value: 'platformFee', sortable: false ,
     text: this.$translate('total_earning'),      value: '', sortable: false 
  ],
  details_headers:[
     text: this.$translate('shop_name'),    value: 'shop_name' ,
     text: this.$translate('date'),    value: 'created' ,
     text: this.$translate('buyer_yippi'),    value: 'yippiWallet' ,
     text: this.$translate('purchase'),       value: 'yippsAmount', sortable: false ,
     text: this.$translate('payment_type'),    value: 'payment_method', sortable: false,
     text: this.$translate('platform_fee'),      value: 'platformFee', sortable: false ,
     text: this.$translate('earning_fee'),      value: '', sortable: false 
  ],
  json:,
  count: 0,
  tableSettingsOne: 
            descending: true,
            sortBy: null,
            rowsPerPage: 25,
            pageSizes: [
                "text":"5","value":5,
                "text":"10","value":10,
                "text":"25","value":25,
                "text":"50","value":50,
                "text":"All","value":-1
            ]
    ,
    tableSettingsTwo: 
            descending: true,
            sortBy: null,
            rowsPerPage: 25,
            pageSizes: [
                "text":"5","value":5,
                "text":"10","value":10,
                "text":"25","value":25,
                "text":"50","value":50,
                "text":"All","value":-1
            ]
    

我要显示的是callback_details中的PAY_TYPE

callback_details: ""TXN_ID":"262439","PAY_TYPE":"VISAMASTER","STATUS_INFO":"2003267b9029b3b"

并且我遇到这些错误:

[Vue warn]: Error in render: "TypeError: Cannot read property 'PAY_TYPE' of null"

TypeError: Cannot read property 'PAY_TYPE' of null

你们都知道要解决此问题吗?谢谢。

答案

您在callback_details上加上了引号:

callback_details: "TXN_ID":"262439","PAY_TYPE":"VISAMASTER","STATUS_INFO":"2003267b9029b3b"

以上是关于渲染错误:“ TypeError:无法读取null的属性'PAY_TYPE'”的主要内容,如果未能解决你的问题,请参考以下文章

Vue 错误:未捕获(在承诺中)TypeError 无法读取 null 的属性(读取“地址”)

TypeError:无法读取 null 的属性(读取“1”)

TypeError:无法读取 null 的属性“调度”

TypeError:无法读取 null 的属性“任何”

× TypeError: 无法读取 null 的属性“名称”

GAS错误:TypeError:无法读取null的属性“ getLastRow”(第4行,文件“ Code2”)