浜笢璺ㄧ缁熶竴妗嗘灦 Taro 1.3 姝e紡鍙戝竷锛氬紩鍏lutter Doctor 锛屽叏闈㈡敮鎸丷eact Hooks鍜孞SX锛屽揩搴旂敤

Posted 寮€鍙戣€呮妧鏈墠绾?/a>

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了浜笢璺ㄧ缁熶竴妗嗘灦 Taro 1.3 姝e紡鍙戝竷锛氬紩鍏lutter Doctor 锛屽叏闈㈡敮鎸丷eact Hooks鍜孞SX锛屽揩搴旂敤相关的知识,希望对你有一定的参考价值。

鐐瑰嚮鈥?/span>寮€鍙戣€呮妧鏈墠绾?/span>鈥濓紝閫夋嫨鈥滄槦鏍囸煍濃€?/span>

13锛?1 鍦ㄧ湅|鏄熸爣|鐣欒█,  鐪熺埍

鏉ユ簮锛氬嚬鍑稿疄楠屽 

寮€鍙戣€呮妧鏈紪杈戦儴锛?/span>鍙彲

Taro 鏄粈涔堬紵

Taro 鏄敱鍑瑰嚫瀹為獙瀹ゆ墦閫犵殑涓€濂楅伒寰?React 璇硶瑙勮寖鐨勫绔粺涓€寮€鍙戞鏋躲€?/span>

鐜板浠婂競闈笂绔殑褰㈡€佸绉嶅鏍凤紝Web銆丄pp 绔?React Native)銆佸井淇″皬绋嬪簭绛夊悇绉嶇澶ц鍏堕亾锛屽綋涓氬姟瑕佹眰鍚屾椂鍦ㄤ笉鍚岀殑绔兘瑕佹眰鏈夋墍琛ㄧ幇鐨勬椂鍊欙紝閽堝涓嶅悓鐨勭鍘荤紪鍐欏濂椾唬鐮佺殑鎴愭湰鏄剧劧闈炲父楂橈紝杩欐椂鍊欏彧缂栧啓涓€濂椾唬鐮佸氨鑳藉閫傞厤鍒板绔殑鑳藉姏灏辨樉寰楁瀬涓洪渶瑕併€?/span>

浣跨敤 Taro锛屾垜浠彲浠ュ彧涔﹀啓涓€濂椾唬鐮侊紝鍐嶉€氳繃 Taro 鐨勭紪璇戝伐鍏凤紝灏嗘簮浠g爜鍒嗗埆缂栬瘧鍑哄彲浠ュ湪涓嶅悓绔紙寰俊灏忕▼搴忋€丠5銆丄pp 绔瓑锛夎繍琛岀殑浠g爜銆傚悓鏃?Taro 杩樻彁渚涘紑绠卞嵆鐢ㄧ殑璇硶妫€娴嬪拰鑷姩琛ュ叏绛夊姛鑳斤紝鏈夋晥鍦版彁鍗囦簡寮€鍙戜綋楠屽拰寮€鍙戞晥鐜囥€?/span>

Taro 鑳芥彁渚涗粈涔堬紵

涓€娆$紪鍐欙紝澶氱杩愯

鏃㈢劧鏄竴涓绔В鍐虫柟妗堬紝Taro 鏈€閲嶈鐨勮兘鍔涘綋鐒舵槸鍐欎竴濂椾唬鐮佽緭鍑哄绔殕鍙繍琛岀殑浠g爜銆傜洰鍓?Taro 宸茬粡鏀寔涓€濂椾唬鐮佸悓鏃剁敓鎴?H5 鍜屽皬绋嬪簭锛孉pp绔?React Native)绔篃鍗冲皢鏀寔锛屽悓鏃惰濡傚揩搴旂敤绛夌涔熷皢寰楀埌鏀寔銆?/span>

鍚屾椂 Taro 涔熷凡缁忔姇鍏ュ埌浜嗙敓浜х幆澧冧娇鐢紝鐩墠宸茬粡鏀拺浜嗕竴涓?3 涓囪浠g爜灏忕▼搴忕殑寮€鍙戝苟涓婄嚎銆備含涓滆喘鐗?灏忕▼搴忓拰 涓€璧锋湁灞€ 灏忕▼搴忎篃鍦ㄤ娇鐢?Taro 閮ㄥ垎閲嶆瀯涓紝鍗冲皢涓婄嚎銆傛湭鏉ヤ篃灏嗘帴鍏ユ洿澶氫笟鍔°€?/span>

Taro 鐨勮璁℃€濊矾

Taro寮€鍙戜汉鍛橈細鎴戜滑鐨勫垵蹇冨氨鏄仛涓€娆捐兘澶熼€傞厤澶氱鐨勮В鍐虫柟妗堬紝缁撳悎涓氬姟鍦烘櫙銆佹妧鏈€夊瀷鍜屽墠绔巻鍙插彂灞曡繘绋嬶紝鎴戜滑鐨勮В鍐虫柟妗堝繀椤绘弧瓒充笅杩拌姹傦細

  • 浠g爜澶氱澶嶇敤锛屼笉浠呰兘杩愯鍦ㄦ椂涓嬫渶鐑棬鐨?H5銆佸井淇″皬绋嬪簭銆丷eact Native锛屽鍏朵粬鍙兘浼氭祦琛岀殑绔篃鐣欐湁浣欏湴鍜屽彲鑳芥€с€?/span>
  • 瀹屽杽鍜屽己澶х殑缁勪欢鍖栨満鍒讹紝杩欐槸寮€鍙戝鏉傚簲鐢ㄧ殑鍩虹煶銆?/span>
  • 涓庣洰鍓嶅洟闃熸妧鏈爤鏈夋満缁撳悎锛屾湁鏁堟彁楂樻晥鐜囥€?/span>
  • 瀛︿範鎴愭湰瓒冲浣?/span>
  • 鑳屽悗鐨勭敓鎬佸己澶?/span>


鍚屾椂婊¤冻杩欏嚑涓渶姹傚苟涓嶅鏄擄紝鍦ㄦ垜浠粡杩囧厖鍒嗗湴璋冪爺鍜屾€濊€冧箣鍚庡彂鐜板彧鏈?React 浣撶郴鑳藉婊¤冻鎴戜滑鐨勯渶姹傘€傝€屽浜庡井淇″皬绋嬪簭鑰岃█锛屼娇鐢?React 瀹屽叏娌℃湁鍔炴硶杩涜寮€鍙戔€斺€旂洿鍒版垜浠粠 codemod 寰楀埌鐏垫劅锛?/span>
鍦ㄤ竴涓紭绉€涓斾弗鏍肩殑瑙勮寖闄愬埗涓嬶紝浠庢洿楂樻娊璞$殑瑙嗚锛堣娉曟爲锛夋潵鐪嬶紝姣忎釜浜哄啓鐨勪唬鐮侀兘宸笉澶氥€?/span>
涔熷氨鏄锛屽浜庡井淇″皬绋嬪簭杩欐牱涓嶅紑鏀句笉寮€婧愮殑绔紝鎴戜滑鍙互鍏堟妸 React 浠g爜鍒嗘瀽鎴愪竴棰楁娊璞¤娉曟爲锛屾牴鎹繖棰楁爲鐢熸垚灏忕▼搴忔敮鎸佺殑妯℃澘浠g爜锛屽啀鍋氫竴涓皬绋嬪簭杩愯鏃舵鏋跺鐞嗕簨浠跺拰鐢熷懡鍛ㄦ湡涓庡皬绋嬪簭妗嗘灦鍏煎锛岀劧鍚庢妸涓氬姟浠g爜璺戝湪杩愯鏃舵鏋跺氨瀹屾垚浜嗗皬绋嬪簭绔殑閫傞厤銆?/span>

瀵逛簬 React 宸茬粡鏀寔鐨勭锛屼緥濡?Web銆丷eact Native 鐢氳嚦鏈潵鐨?React VR锛屾垜浠彧瑕佸寘涓€灞傜粍浠跺簱鍐嶅仛浜涜鏍峰紡鏀寔鍗冲彲銆傞壌浜庢椂涓嬪皬绋嬪簭鐨勭儹搴﹀拰鎴戜滑鍥㈤槦鏈韩鐨勪笟鍔′晶閲嶇▼搴︼紝缁勪欢搴撶殑 API 鏄互灏忕▼搴忎负鏍囧噯锛屽叾浠栫鐨勭粍浠跺簱鐨?API 閮戒細鍜屽皬绋嬪簭绔殑缁勪欢淇濇寔涓€鑷淬€?/span>


浜笢璺ㄧ缁熶竴妗嗘灦 Taro 1.3 姝e紡鍙戝竷锛氬紩鍏lutter Doctor 锛屽叏闈㈡敮鎸丷eact Hooks鍜孞SX锛屽揩搴旂敤


Taro 1.2鍙戝竷浠ユ潵锛?.3 缁忓巻浜? 涓湀鐨勫紑鍙戞椂闂达紝杩?2鍗冩鐨勪唬鐮乸r锛岄櫎浜嗕含涓滃唴閮紝杩樻湁琛屼笟鐧句綅寮€鍙戣€呯殑鍏卞悓鍙備笌銆?/span>

Taro 1.3 鐨勭壒鎬у寘鎷涓?
  • 鏀寔蹇簲鐢ㄥ拰 QQ 灏忕▼搴忕殑寮€鍙?/span>
  • 鍏ㄩ潰鏀寔 JSX 璇硶鍜?React Hooks
  • 澶у箙鎻愰珮 H5 鎬ц兘鍜屽彲鐢ㄦ€?/span>
  • 鏂板 Taro Doctor

鏀寔 JSX 璇硶鍜?React Hooks

鈥?/span>

鍦?Taro 1.3 涓紝寮€鍙戣€呭彲浠ュ厖鍒嗗彂鎸ヨ嚜宸辩殑鍒涢€犲姏鍜屾兂璞″姏锛屽彲闅忔剰鍦板啓  if-else 锛岄殢鎰忓湴鍐欏尶鍚嶅嚱鏁帮紝鎶?JSX 鏀惧湪绫诲嚱鏁颁腑锛屼篃鍙互鏀惧湪鏅€氬嚱鏁颁腑銆傚彧瑕佺紪璇戝櫒鍜屽拰 ESLint 涓嶆姤閿欙紝灏卞彲浠ヨ繖涔堝啓銆?/span>

寮€鍙戝洟闃熶紭鍏堟妸 React Hooks 甯﹀埌浜?Taro 涓紝杩樺啓浜嗕袱涓皬渚嬪瓙灞曠ず濡備綍鍦?Taro 涓娇鐢?Hooks锛?/span>
V2EX:  
https://github.com/NervJS/taro-v2ex-hooks
TodoMVC:  
https://github.com/NervJS/taro-todomvc-hooks

浜笢璺ㄧ缁熶竴妗嗘灦 Taro 1.3 姝e紡鍙戝竷锛氬紩鍏lutter Doctor 锛屽叏闈㈡敮鎸丷eact Hooks鍜孞SX锛屽揩搴旂敤


鏀寔 QQ 灏忕▼搴忓拰蹇簲鐢?/span>

鈥?/span>

蹇簲鐢ㄧ殑寮€鍙戞ā寮忛潪甯哥壒鍒紝瀹冪殑 API銆佺粍浠剁郴缁熴€佺粍浠跺簱鍜屽叾浠栧皬绋嬪簭绔樊寮傞潪甯稿ぇ锛屽苟涓斿揩搴旂敤鏈夎嚜宸辩殑鏍囧噯瑙勮寖锛屽悇澶у畨鍗撳巶鍟嗗杩愯鏃剁殑瀹炵幇鍜岄檺鍒朵篃鍚勪笉鐩稿悓銆傝繖鍧楃棝鐐圭粓浜庝篃琚?Taro 瑙e喅浜嗐€?/span>

QQ 灏忕▼搴忎綔涓烘柊鍏寸殑灏忕▼搴忥紝澶у鏅亶瀵瑰畠浜嗚В涓嶅锛屼絾 Taro 涔熺巼鍏堝疄鐜颁簡瀵?QQ 灏忕▼搴忕殑鏀寔銆?/span>

鎰忓懗鐫€锛屼笉绠′綘鐨勪笟鍔¤鏀寔鍝竴涓皬绋嬪簭绔紝鍙缁存姢涓€濂椾唬鐮侊紝Taro 灏辫兘鐢熸垚瀵瑰簲灏忕▼搴忓钩鍙扮殑浠g爜銆傚悓鏃?Taro 涔熸垚涓轰簡涓氱晫棣栦釜鍚屾椂鏀寔寰俊銆佺櫨搴︺€佸瓧鑺傝烦鍔ㄣ€佹敮浠樺疂銆丵Q 灏忕▼搴忓拰蹇簲鐢ㄥ叡 6 绔皬绋嬪簭鐨勫紑鍙戞鏋躲€?/span>

鏂板鏂扮殑鐢熷懡鍛ㄦ湡鍜?Context API

鈥?/span>

鍦?Taro 1.3 鏀寔浜?React 16 鐨勬柊鐢熷懡鍛ㄦ湡鍑芥暟static getDerivedStateFromProps()鍜?getSnapshotBeforeUpdate() 銆傚綋鏂扮殑鐢熷懡鍛ㄦ湡鍑芥暟娉ㄥ叆鍒扮被缁勪欢鏃讹紝鑰佺殑鐢熷懡鍛ㄦ湡鍑芥暟灏嗕笉浼氳璋冪敤锛岃兘鍑忓皯涓€娆℃覆鏌撳拰鏇存柊鐨勫紑閿€銆?/span>

Taro 1.3 杩樺疄鐜颁簡 鏂?Context 閫氳繃澹版槑寮忕殑 API 鏉ヤ紶閫掔粍浠剁殑鏇存柊锛屼娇寰桾aro 璺ㄧ粍浠堕€氫俊鍜屽叡浜姸鎬佹洿涓虹洿瑙傘€傚悓鏃讹紝渚嬪  react-redux  杩欐牱鐨勭儹闂ㄥ簱涔熸鍦ㄥ熀浜?nbsp; Context  鍜?nbsp; Hooks  杩涜閲嶆瀯锛屾垜浠篃闈炲父鏈熷緟涓庣ぞ鍖轰竴璧锋帰绱?React/Taro 鏂扮殑寮€鍙戜笌璁捐妯″紡銆?/span>

澶у箙鎻愰珮 H5 鎬ц兘鍜屽彲鐢ㄦ€?/span>

鈥?/span>

鍦?Taro 1.3 涓紝浼樺寲浜嗙紪璇戜唬鐮佺殑鏂瑰紡锛屽疄鐜颁簡璧勬簮鏈€灏忓紩鍏ュ拰鎸夐渶鍔犺浇寮曞叆锛屽皢鍘熸湁鏈€灏忛」鐩殑缂栬瘧澶у皬闄嶄綆浜?80% 宸﹀彸銆傛彁楂樼敤鎴锋瀬鑷翠綋楠屻€?/span>

H5 绔殑 API 鏁伴噺鍜岃川閲忎篃寰楀埌浜嗗ぇ骞呭湴澧為暱锛孴aro 1.3 鏂板浜?28 涓?H5 API銆?/span>

Taro Doctor

鈥?/span>

浠?Flutter Doctor 涓緱鍒板惎鍙戯紝寮€鍙戜簡 Taro Doctor銆俆aro Doctor 灏卞儚涓€涓尰鐢熸姢澹竴鏍凤紝鏈夎瘖鏂」鐩殑渚濊禆銆佽缃€佺粨鏋勶紝浠ュ強浠g爜鐨勮鑼冩槸鍚﹀瓨鍦ㄩ棶棰樼殑鑳藉姏锛屽苟灏濊瘯缁欏嚭瑙e喅鏂规銆?/span>

浣嗗拰鐪熸鐨勫尰鐢熶笉涓€鏍凤紝Taro Doctor 涓嶉渶绛夊緟闃熷垪銆備綘鍙渶瑕佸湪缁堢杩愯鍛戒护锛歵aro doctor 锛屽氨鍍忎笅鍥鹃噷涓€鏍凤細


浜笢璺ㄧ缁熶竴妗嗘灦 Taro 1.3 姝e紡鍙戝竷锛氬紩鍏lutter Doctor 锛屽叏闈㈡敮鎸丷eact Hooks鍜孞SX锛屽揩搴旂敤

鏇村

鈥?/span>

Taro 1.3 杩樺仛浜嗚澶氶澶栫殑宸ヤ綔锛屼负Taro 鐨勭ǔ瀹氭€т互鍙婂皢鏉ユ洿澶氱殑鍙兘鎬уく瀹炰簡鍩虹锛?/span>


缁勪欢浼犲弬锛坧rops锛夌郴缁熼噸鏋?/span>

鍦?nbsp; Taro 1.0 鍒?1.2 鐨勫皬绋嬪簭绔紝鎴戜滑涓€鐩翠娇鐢ㄥ師鐢熷皬绋嬪簭妗嗘灦鐨勭粍浠朵紶鍙傜郴缁燂紝浣嗗皬绋嬪簭缁勪欢绯荤粺娌″姙娉曚紶閫掑嚱鏁扮殑鍊硷紝涔熸棤娉曚紶閫掗潪鍏峰悕鍙傛暟锛屽苟涓斿悇灏忕▼搴忕粍浠剁殑瀹炵幇鍚勪笉鐩稿悓銆備负浜嗚В鍐宠繖浜涢棶棰橈紝鍦?Taro 1.3 涓垜浠嚜宸卞疄鐜颁簡涓€濂楃粍浠朵紶鍙傜郴缁熴€傛柊绯荤粺浼氫娇寰椾紶鍙傜浉鍏崇殑浠g爜鏇翠负鍙潬锛屽悓鏃朵篃鏄垜浠敮鎸佹洿澶?JSX 璇硶鐨勫熀纭€銆?/span>


鍛戒护琛屽伐鍏凤紙CLI锛?閲嶆瀯


鍦?Taro 1.3锛屾垜浠皢鍛戒护琛屽伐鍏蜂娇鐢?TypeScript 杩涜浜嗛噸鏋勫苟閫愭娣诲姞鏇村娴嬭瘯鐢ㄤ緥銆傞噸鏋勪箣鍚庢垜浠彲浠ユ洿鍔犲ぇ鑳嗗湴涓?CLI 娣诲姞鏂板姛鑳斤紝鏇挎崲鑰佹棫渚濊禆銆傚悓鏃舵垜浠篃浼氬皢 CLI 鐨勫姛鑳戒互 API 鐨勫舰寮忔毚闇插嚭鏉ワ紝璧嬭兘缁欏叾瀹冨紑鍙戝伐鍏峰拰鎴戜滑鐨勫悎浣滀紮浼淬€?/span>


绉诲姩绔鍣ㄦ洿鎹?/span>

鎴戜滑鍜屼含涓滅殑 ARES 鍥㈤槦鍚堜綔锛屾妸鍘熸湁鐨勭Щ鍔ㄧ瀹瑰櫒 expo 鏇挎崲涓烘繁搴﹀畾鍒剁殑 JDReact銆侸DReact 澶у箙鎻愬崌浜?Taro 绉诲姩绔殑鍙帶鎬э紝鍙互璁╂垜浠獊鐮?expo 鐨勬帲鑲橈紝寮曞叆鍘熺敓绉诲姩绔唬鐮侊紝鎻愪緵瀹氬埗鍔熻兘鍜?API锛屽苟涓旀€ц兘鍜岀ǔ瀹氭€х殑琛ㄧ幇閮戒細鏇村ソ銆?/span>


鏀寔寮€鍙戝皬绋嬪簭鎻掍欢

灏忕▼搴忔彃浠舵槸灏忕▼搴忓甫鏉ョ殑涓€涓潪甯镐紭绉€鐨勭壒鎬э紝鍙互鏋佸ぇ鍦版彁楂樹唬鐮佸鐢ㄧ巼锛岄檷浣庡寘澶у皬锛屼负寮€鍙戣€呭甫鏉ヨ澶氫究鍒╋紝鐩墠寰俊銆佹敮浠樺疂灏忕▼搴忓凡缁忔敮鎸佹彃浠跺姛鑳姐€傝€屼粠 1.3 鐗堟湰寮€濮嬶紝Taro 鏀寔鐩存帴寮€鍙戝井淇′笌鏀粯瀹濆皬绋嬪簭鎻掍欢锛岃繖鎰忓懗鐫€ Taro 椤圭洰灏嗗拰灏忕▼搴忔彃浠舵棤缂濆鎺ワ紝涓嶅啀鏈夊紑鍙戞ā寮忓垏鎹㈢殑鎴愭湰銆?/span>


鏀寔銆屽皬绋嬪簭路浜戝紑鍙戙€?/span>

銆屽皬绋嬪簭路浜戝紑鍙戙€嶆槸寰俊灏忕▼搴忚仈鍚堣吘璁簯鍥㈤槦鎻愪緵鐨勪竴涓潪甯稿己澶х殑鍔熻兘锛屽畠鏄竴娆?Serverless 鏈嶅姟锛屼负寮€鍙戣€呮彁渚涗簡銆屼簯鍑芥暟銆嶃€併€屼簯鏁版嵁搴撱€嶅拰銆屼簯鏂囦欢瀛樺偍銆嶄笁澶ц兘鍔涳紝骞朵笖灏嗚繖浜涜兘鍔涘皝瑁呮垚鐗瑰畾鐨勬帴鍙o紝鍙互甯姪寮€鍙戣€呭揩閫熸瀯寤哄井淇″皬绋嬪簭鐨勫悗绔湇鍔°€備负浜嗚 Taro 寮€鍙戣€呰兘澶熶韩鍙楀埌銆屽皬绋嬪簭路浜戝紑鍙戙€嶇殑鑳藉姏锛孴aro 涔熷姞鍏ヤ簡瀵广€屽皬绋嬪簭路浜戝紑鍙戙€嶇殑鏀寔锛屼负銆屽皬绋嬪簭路浜戝紑鍙戙€嶆彁渚涗簡鍒濆鍖栨ā鏉匡紝骞朵笖灏嗗皬绋嬪簭浜戠浉鍏崇殑 API 杩涜浜嗗皝瑁咃紝鏂逛究寮€鍙戣€呰繘琛屼娇鐢ㄣ€傚悓鏃讹紝銆屽皬绋嬪簭路浜戝紑鍙戙€嶅凡鎻愪緵 H5 鐗堟湰鐨?SDK锛孴aro 鏀寔灏嗗皬绋嬪簭銆丠5 鐨勮皟鐢ㄦ柟寮忚繘琛岀粺涓€灏佽锛屽府鍔╁紑鍙戣€呭揩閫熸墦閫?Serverless 鐨勫绔簲鐢ㄣ€?/span>

鍗囩骇鍏煎鎬?/span>

鈥?/span>

姝e鍓嶉潰鎵€鎻愬埌锛孴aro 1.3 鏄竴涓厺閰挎椂闂存渶涔咃紝鎷ユ湁鐗规€ф渶澶氱殑澶х増鏈紝瀵?Taro 搴曞眰涔熻繘琛屼簡涓嶅皬鐨勯噸鏋勶紝鎵€浠ワ紝1.3 鐗堟湰鐨勫崌绾у甫浜嗕互涓?2 涓吋瀹规€ч棶棰樸€?/span>


JSX 涓殑浜嬩欢鐩戝惉鍑芥暟蹇呴』缁戝畾浣滅敤鍩?/span>

鍦ㄤ箣鍓嶇殑 Taro 鐗堟湰涓紝JSX 涓粦瀹氱殑浜嬩欢鐩戝惉鍑芥暟锛屾槸鍙互涓嶉渶瑕佺粦瀹氫换浣曚綔鐢ㄥ煙锛屽氨鑳借闂埌缁勪欢瀹炰緥鐨勶紝渚嬪锛?/span>

import Taro, { Component, Config } from '@tarojs/taro'import { View, Button } from '@tarojs/components'
export default class Test extends Component { state = { hello: 'noclick' } clickHandler () { this.setState({ hello: 'click' }) }
render () { return ( <View className={styles.index}> <Button onClick={this.clickHandler}>鐐瑰嚮</Button> </View> ) }}


涓婅堪渚嬪瓙涓紝 <Button />  鎸夐挳缁戝畾鐨勭偣鍑讳簨浠讹紝鍦ㄤ箣鍓嶇増鏈腑鏄兘澶熸甯告墽琛岀殑锛孴aro 浼氶粯璁ゅ皢  clickHandler  鐨勪綔鐢ㄥ煙缁戝畾涓哄綋鍓嶇粍浠跺疄渚嬶紝浣嗘槸杩欏苟涓嶇鍚?React 涓殑瀹為檯鎯呭喌锛屾墍浠ワ紝鍦?1.3 鐗堟湰涓紝鎴戜滑瀵硅繖涓€闂杩涜浜嗕慨澶嶏紝鐜板湪 JSX 涓殑浜嬩欢鐩戝惉鍑芥暟蹇呴』缁戝畾浣滅敤鍩燂紝鍚﹀垯灏变細鎶ラ敊銆?/span>

涓婅堪浠g爜涓?JSX 閮ㄥ垎鍙互淇敼涓哄涓嬶細

render () { return ( <View className={styles.index}> <Button onClick={this.clickHandler.bind(this)}>鐐瑰嚮</Button> </View> )}


鎴栬€呬綘涔熷彲浠ュ湪 `constructor` 涓皢鍑芥暟杩涜鎻愬墠缁戝畾浣滅敤鍩?/span>


constructor () { this.clickHandlerBind = this.clickHandler.bind(this)}
render () { return ( <View className={styles.index}> <Button onClick={this.clickHandlerBind}>鐐瑰嚮</Button> </View> )}


杩樻湁涓€绉嶅仛娉曟槸锛屽皢  clickHandler  鍐欐垚绠ご鍑芥暟锛岃繖绉嶆柟寮忓湪鏂版棫鐗堟湰涓潎鍙互姝e父杩愯銆?/span>


鏆傛椂鏃犳硶鍦ㄥ師鐢熷簲鐢ㄤ腑浣跨敤 Taro 缁勪欢锛屽悗缁敮鎸?/span>


缁撹


缁忚繃鏁颁釜鏈堢殑寮€鍙戯紝Taro 浠庣涓€娆?commit 鍒板彂灞曟垚鍖呮嫭 16 涓寘锛屽崄澶氫綅鍚屽鍏卞悓鍙備笌鐨勫ぇ鍨嬮」鐩€備笌姝ゅ悓鏃讹紝Taro 涔熷湪鐢熶骇鐜鏀拺浜嗘暟涓鏉備笟鍔$嚎涓婇」鐩殑寮€鍙戯紝灏嗘潵涔熶細鏀拺鏇村涓氬姟銆?/span>


Taro 鐨勬妧鏈柟妗堝拰瀹炵幇涔熸牴妞嶄簬绀惧尯锛屾垜浠篃甯屾湜涓烘妧鏈ぞ鍖虹殑鍙戝睍澹ぇ璐$尞涓€浠借嚜宸辩殑鍔涢噺銆傜鎸佺潃鍑瑰嚫瀹為獙瀹ら暱涔呬互鏉ュ紑婧愩€佸紑鏀俱€佸叡浜殑浼樿壇浼犵粺锛屾垜浠粖澶╁皢 Taro 鍏ㄩ儴浠g爜寮€婧愶紝涓哄箍澶у紑鍙戣€呭揩閫熷紑鍙戝绔」鐩彁渚涗竴鏁村鎶€鏈В鍐虫柟妗堛€傛湭鏉ワ紝鎴戜滑涔熷皢缁х画鎷撳睍 Taro 鐜版湁鑳藉姏锛屾敮鎸佹洿澶氱鑳藉姏锛岀户缁畬鍠勫紑鍙戣€呬綋楠岋紝鎻愰珮寮€鍙戣€呮晥鐜囷紝甯姪鏇村寮€鍙戣€咃紝鍚屾椂涔熶粠绀惧尯涓辈鍙栧吇鍒嗭紝璁?Taro 鍙樺緱鏇村姞寮哄ぇ銆?/span>

Taro 瀹樼綉锛歨ttps://taro.jd.com

GitHub: https://github.com/NervJS/taro

END
寮€鍙戣€呮妧鏈墠绾?锛屾眹闆嗘妧鏈墠绾垮揩璁拰鍏虫敞琛屼笟瓒嬪娍锛屽ぇ鍘傚共璐э紝鏄紑鍙戣€呯粡鍘嗗拰鎴愰暱鐨勪紭绉€鎸囧崡銆?/span>
鍘嗗彶鎺ㄨ崘




浜笢璺ㄧ缁熶竴妗嗘灦 Taro 1.3 姝e紡鍙戝竷锛氬紩鍏lutter Doctor 锛屽叏闈㈡敮鎸丷eact Hooks鍜孞SX锛屽揩搴旂敤
浜笢璺ㄧ缁熶竴妗嗘灦 Taro 1.3 姝e紡鍙戝竷锛氬紩鍏lutter Doctor 锛屽叏闈㈡敮鎸丷eact Hooks鍜孞SX锛屽揩搴旂敤
濂芥枃鐐逛釜鍦ㄧ湅鍚э紒

以上是关于浜笢璺ㄧ缁熶竴妗嗘灦 Taro 1.3 姝e紡鍙戝竷锛氬紩鍏lutter Doctor 锛屽叏闈㈡敮鎸丷eact Hooks鍜孞SX锛屽揩搴旂敤的主要内容,如果未能解决你的问题,请参考以下文章

浜笢鎺ㄥ嚭杞婚噺绾у垎甯冨紡 RPC 妗嗘灦 鈥?EasyRPC

Python Django妗嗘灦瀹炵幇鍟嗗煄椤圭洰婧愮爜鍔犺璁℃枃妗e拰娉ㄩ噴

KoP 姝e紡寮€婧愶細鍦?Apache Pulsar 涓婃敮鎸佸師鐢?Kafka 鍗忚

鎵嬫満QQ 寮€婧愬熀浜嶧lutter 鐨勫姩鎬佸寲妗嗘灦 MXFlutter 锛岀墰閫硷紒

鏃犳剰璇嗙殑閫掑綊

MyBatis妗嗘灦鍏ラ棬