第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

用 antd mobile 的ListView的時候遇到的問題

用 antd mobile 的ListView的時候遇到的問題

qq_笑_17 2019-02-25 12:27:29
Stateless function components cannot be given refs. Attempts to access this ref will fail. <div>    <ListView      ref={ el => this.lv = el }      dataSource={ this.state.dataSource }      renderScrollComponent={ () => <MyBody /> }      renderRow={row}      onEndReachedThreshold={100}      onEndReached={this.getList}      style={{        height: '500px',        overflow: 'auto',      }}    /></div>在使用的時候報這個錯  而且為什么react有時候使用 refs 只能獲取組件實例   不能獲取真實的dom節(jié)點?
查看完整描述

1 回答

?
湖上湖

TA貢獻2003條經(jīng)驗 獲得超2個贊

這個異常的解決方式是把stateless組件修改為class
但是你引用的是第三方的。所以這個方式應該無效。
所以你不能在ListView組件中用refs來獲取數(shù)據(jù),只能通過其他方式獲取,比如回調(diào)。

再次強調(diào),使用react就忘掉真實dom吧。不要嘗試獲取真實dom,也不要操作真實Dom


查看完整回答
反對 回復 2019-03-07
  • 1 回答
  • 0 關(guān)注
  • 2515 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號