天天看点

#yyds干货盘点# 【React工作记录三十八】对象的属性和值转换

前言

我是歌谣 我有个兄弟 巅峰的时候排名c站总榜19 叫前端小歌谣 曾经我花了三年的时间创作了他 现在我要用五年的时间超越他 今天又是接近兄弟的一天人生难免坎坷 大不了从头再来 歌谣的意志是永恒的 放弃很容易 但是坚持一定很酷

导语

歌谣 歌谣 这边封装了一个组件 组件里面传入的值必须有一个固定格式belongListData

          ? belongListData?.belongList 必须是个belongList

#yyds干货盘点# 【React工作记录三十八】对象的属性和值转换
#yyds干货盘点# 【React工作记录三十八】对象的属性和值转换

解决思路

if (
      belongListData.hasOwnProperty('inCustomerBelongList') 
||
      belongListData.hasOwnProperty('outCustomerBelongList')

    ) {
      belongListData.belongList =
        belongListData.inCustomerBelongList 
|| belongListData.outCustomerBelongList;
    }      
#yyds干货盘点# 【React工作记录三十八】对象的属性和值转换

 解决思路

继续阅读