{"id":432028,"date":"2021-04-18T13:37:20","date_gmt":"2021-04-18T05:37:20","guid":{"rendered":"http:\/\/4563.org\/?p=432028"},"modified":"2021-04-18T13:37:20","modified_gmt":"2021-04-18T05:37:20","slug":"%e6%a5%bc%e4%b8%bb%e4%b8%80%e7%9b%b4%e6%b2%a1%e6%9c%89%e5%bc%84%e6%98%8e%e7%99%bd%ef%bc%8c%e9%82%a3%e4%b8%aa-ref-%e5%af%b9%e8%b1%a1-%e5%88%b0%e5%ba%95%e6%98%af%e5%95%a5%ef%bc%9f-html-%e9%87%8c","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=432028","title":{"rendered":"\u697c\u4e3b\u4e00\u76f4\u6ca1\u6709\u5f04\u660e\u767d\uff0c\u90a3\u4e2a ref \u5bf9\u8c61 \u5230\u5e95\u662f\u5565\uff1f html \u91cc\u9762\u597d\u50cf\u6709\uff0c react \u91cc\u9762\u4e5f\u7ecf\u5e38\u770b\u5230\uff0c\u4ec0\u4e48 useRef"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u4e3b\u4e00\u76f4\u6ca1\u6709\u5f04\u660e\u767d\uff0c\u90a3\u4e2a ref \u5bf9\u8c61 \u5230\u5e95\u662f\u5565\uff1f html \u91cc\u9762\u597d\u50cf\u6709\uff0c react \u91cc\u9762\u4e5f\u7ecf\u5e38\u770b\u5230\uff0c\u4ec0\u4e48 useRef               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yazoox <\/span>  <span><i><\/i> 12<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u7c7b\u4f3c\u4e8e\uff0c<\/p>\n<pre><code>  &lt;input ref={\u8fd9\u4e2a\u4e1c\u4e1c} type=\"text\" \/&gt; <\/code><\/pre>\n<p>\u6216\u8005\uff0creactjs \u91cc\u9762\u7684 useRef\uff0c\u8fd8\u7ecf\u5e38\u770b\u5230 forwardRef, etc.<\/p>\n<p>\u53ef\u662f\uff0c\u4e00\u76f4\u90fd\u5f04\u4e0d\u660e\u767d\uff0c\u8fd9\u4e2a Ref \u5230\u5e95\u662f\u4e2a\u5565\uff1f\u6709\u6ca1\u6709\u6587\u6863\u80fd\u591f\u8a00\u7b80\u610f\u8d45\u7684\u8bb2\u6e05\u695a\u7684\uff1f\u8c22\u8c22<\/p>\n<p>p.s. \u4e0d\u77e5\u9053\u8fd9\u4e2a\u4e3b\u9898\u662f\u5e94\u8be5\u653e\u5230 html \u8fd8\u662f javascript\uff0c\u7248\u4e3b\u89c9\u5f97\u8981\u662f\u4e0d\u5408\u9002\uff0c\u5e2e\u5fd9\u642c\u4e00\u4e0b\u3002\u8c22\u8c22\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>26<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5679590\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mxT52CRuqR6o5 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/reactjs.org\/docs\/refs-and-the-dom.html#gatsby-focus-wrapper<br \/>react \u7684\u4e00\u4e2a\u6982\u5ff5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679591\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 66beta <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/zh-hans.reactjs.org\/docs\/refs-and-the-dom.html                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679592\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : vivipure <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             React \u548c Vue \u4e2d\u90fd\u6709 ref, \u4e3b\u8981\u662f\u4e3a\u4e86\u6846\u67b6\u64cd\u4f5c dom \u6216\u8005\u7ec4\u4ef6\u7528\u7684\uff1b\u4e5f\u6ca1\u5565\u597d\u8bb0\u5f97                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679593\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zhuweiyou <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u64cd\u4f5c dom \u6216\u8005\u8c03\u7528\u7ec4\u4ef6\u65b9\u6cd5\u65f6\u7528\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679594\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cydysm <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528\u6765\u83b7\u53d6 element \u5b9e\u4f8b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679595\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : RomeoHong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u7406\u89e3\u7c7b\u4f3c\u4e8e\u5f15\u7528 \/\u6307\u9488\uff0c\u5bf9 DOM \u5bf9\u8c61\u6216\u7ec4\u4ef6\u5b9e\u4f8b\u7684\u5f15\u7528\uff0c\u5f15\u7528\u540e\u53ef\u4ee5\u8c03\u7528 DOM \u5bf9\u8c61\u4e0a\u6216\u7ec4\u4ef6\u5b9e\u4f8b\u7684\u4e0a\u7684\u65b9\u6cd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679596\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : superrichman <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u73a9\u610f\u662f\u4e0d\u662f\u8ddf getElementById \u5dee\u4e0d\u591a\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679597\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dablwow <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5c31\u662f referrence\uff0c\u4ee3\u8868\u5f15\u7528\uff0c\u53c8\u56e0\u4e3a\u201c\u5f15\u7528\u201d\u6982\u5ff5\u5bbd\u6cdb\uff0c\u5b9e\u9645\u4ee3\u8868\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u5404\u573a\u666f\u5b9e\u9645\u6240\u9700                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679598\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liuy1994g <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u201c\u5f15\u7528\u201d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679599\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : IsaacYoung <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             ref = {current: any}                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679600\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liuy1994g <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5728\u539f\u751f dom \u4e0a\u7528\u83b7\u53d6\u8be5 dom\uff0c\u5728\u7ec4\u4ef6\u4e0a\u7528\u83b7\u53d6\u8be5\u5b9e\u4f8b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679601\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : momocraft <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e00\u500b callback \u51fd\u6578\u6216\u5c0d\u8c61 box<br \/>react \u5b8c\u6210\u6e32\u67d3\u5f8c\u628a\u76f8\u95dc\u5c0d\u8c61 (dom element \u6216 class component) \u50b3\u9032\u53bb, \u4f60\u53bb\u7528                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679602\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Jooooooooo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5c31\u662f\u5f15\u7528\u7684\u610f\u601d reference                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679603\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Kasumi20 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e00\u4e2a ObjectWrapper\uff0c\u6bd4\u5982 Java \u4e2d\u7684\u533f\u540d\u51fd\u6570\u8bbf\u95ee\u51fd\u6570\u5185\u90e8\u7684 int \u53d8\u91cf\u65f6\uff0c\u5fc5\u987b\u662f final \u7684\uff0c\u65e0\u6cd5\u4fee\u6539\uff0c\u4f46\u662f\u53ef\u4ee5\u7528\u4e00\u4e2a ObjectWrapper{ public int value }\u628a\u8fd9\u4e2a int \u53d8\u91cf\u5305\u88c5\u4e00\u4e0b\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679604\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nnnToTnnn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u597d\u5bb6\u4f19, \u5413\u6211\u4e00\u8df3, \u6211\u4ee5\u4e3a html \u91cc\u9762\u5c45\u7136\u6709 ref \u6765\u53d6\u53d8\u91cf, \u90a3\u5c82\u4e0d\u662f\u524d\u7aef\u8981\u53d8\u5929, \u6211\u4e00\u770b, w3c \u7684\u6587\u6863\u8fd8\u662f\u8001\u6837\u5b50. <\/p>\n<p>\u5982\u679c\u662f react \u6216\u5219\u5176\u4ed6\u4e09\u65b9\u5e93 ,ref \u8868\u793a \u8fd9\u4e2a\u5143\u7d20\u7684 \u5f15\u7528, \u53ef\u4ee5\u901a\u8fc7\u5b83\u6765\u4f7f\u7528\u771f\u5b9e\u7684 dom \u5143\u7d20\u7684\u4e00\u4e9b\u65b9\u6cd5\u548c\u5c5e\u6027.                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679605\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : annielong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7b2c\u4e09\u65b9\u7684\u5e93\uff0c\u770b\u7b2c\u4e09\u65b9\u7684\u8bf4\u660e\uff0c\u539f\u751f html \u6ca1\u6709\u8fd9\u4e2a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679606\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : MeteorCat <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             react \u4e3b\u8981\u7528\u6765\u6807\u8bc6\u67d0\u4e2a\u7ec4\u4ef6\uff0c\u65b9\u4fbf\u76f4\u63a5\u67e5\u627e\u8bbf\u95ee                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679607\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiaojun1994 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5f15\u7528\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679608\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : no1xsyzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u662f React \u548c Vue \u91cc\u7c7b\u4f3c getElement(s)By* \u6216\u8005 Query Selector \u7684\u4e00\u4e2a\u4e1c\u897f\uff0c\u4f46\u8bbe\u8ba1\u4e0a\u76f8\u5bf9\u66f4\u7a33\u5065\u548c\u53ef\u9884\u6d4b<\/p>\n<p>\u4e00\u822c\u4e0d\u63a8\u8350\u5927\u9762\u79ef\u7528\uff0cVue \u7684\u6838\u5fc3\u601d\u8def\u662f\u81ea\u9876\u5411\u4e0b\u4f20\u9012\u6570\u636e\u7528 prop\uff0c\u81ea\u5e95\u5411\u4e0a\u4f20\u9012\u6570\u636e\u7528 event \u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679609\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : DOLLOR <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             react \u5b98\u65b9\u6587\u6863\u5199\u7740\u5462<br \/>https:\/\/zh-hans.reactjs.org\/docs\/hooks-reference.html#useref                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679610\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Rocketer <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3b\u9700\u8981\u8865\u70b9 React \u7684\u57fa\u7840\u77e5\u8bc6\u3002<\/p>\n<p>\u4e00\u65b9\u9762\uff0cReact \u662f\u51fd\u6570\u5f0f\u7f16\u7a0b\uff0c\u8981\u60f3\u6539\u53d8\u5bf9\u8c61\u7684\u72b6\u6001\uff0c\u4e0d\u662f\u66f4\u65b0\u5bf9\u8c61\u91cc\u9762\u7684\u503c\uff0c\u800c\u662f\u7528\u65b0\u7684\u503c\u91cd\u65b0\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5bf9\u8c61\u3002\u4f46\u4efb\u4f55\u6a21\u5f0f\u90fd\u4e0d\u662f\u4e07\u80fd\u7684\uff0cref \u7684\u5b58\u5728\u5c31\u662f\u4e3a\u4e86\u7167\u987e\u4e00\u4e9b\u786e\u5b9e\u9700\u8981\u8bbf\u95ee\u540c\u4e00\u5bf9\u8c61\u7684\u60c5\u51b5\u3002<\/p>\n<p>\u53e6\u4e00\u65b9\u9762\uff0cReact \u91cc\u7684&lt;input ref={\u8fd9\u4e2a\u4e1c\u4e1c} type=&#8221;text&#8221; \/&gt;\u4e5f\u4e0d\u662f html\uff0c\u800c\u662f jsx\uff0c\u5b83\u662f\u4eff\u7167 html \u7684\u8bed\u6cd5\u5199\u7684\uff0c\u4f46\u53c8\u5f88\u4e0d\u4e00\u6837\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679611\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : feeeff <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Rocketer \u8001\u54e5\u4f60\u597d \u5bf9\u4f60\u8fd9\u6bb5\u8bdd\u4e0d\u662f\u7279\u522b\u7406\u89e3<\/p>\n<p>&gt; \u4e00\u65b9\u9762\uff0cReact \u662f\u51fd\u6570\u5f0f\u7f16\u7a0b\uff0c\u8981\u60f3\u6539\u53d8\u5bf9\u8c61\u7684\u72b6\u6001\uff0c\u4e0d\u662f\u66f4\u65b0\u5bf9\u8c61\u91cc\u9762\u7684\u503c\uff0c\u800c\u662f\u7528\u65b0\u7684\u503c\u91cd\u65b0\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5bf9\u8c61\u3002\u4f46\u4efb\u4f55\u6a21\u5f0f\u90fd\u4e0d\u662f\u4e07\u80fd\u7684\uff0cref \u7684\u5b58\u5728\u5c31\u662f\u4e3a\u4e86\u7167\u987e\u4e00\u4e9b\u786e\u5b9e\u9700\u8981\u8bbf\u95ee\u540c\u4e00\u5bf9\u8c61\u7684\u60c5\u51b5\u3002<\/p>\n<p>\u54ea\u4e9b\u60c5\u51b5\u662f \u300c\u7167\u987e\u4e00\u4e9b\u786e\u5b9e\u9700\u8981\u8bbf\u95ee\u540c\u4e00\u5bf9\u8c61\u300d\uff0c\u80fd\u4e3e\u4e2a\u4f8b\u5b50\u5417\uff1f\u8c22\u8c22\u4e86                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679612\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : learningman <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @feeeff \u6bd4\u5982\u8bf4\u4f60\u8fd9\u4e2a\u7f51\u9875\u4e0d\u662f\u5168\u90e8\u7528 react \u5199\u7684\uff0c\u4f60\u8981\u8bbf\u95ee\u4e00\u4e9b\u5386\u53f2\u9057\u7559\u7684\u7ec4\u4ef6\u4e0a\u7684\u503c\uff0c\u4e0d\u5c31\u53ea\u80fd\u7528\u8fd9\u4e2a\u4e86\u5417                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679613\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dablwow <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @feeeff \u6bd4\u5982\uff0c\u4e00\u4e2a\u7ec4\u4ef6\u5728\u6bcf\u6b21\u6e32\u67d3\u65f6\uff0c\u90fd\u8981\u5bf9\u6bd4\u4e0a\u4e00\u6b21\u7684 props \u503c\uff0c\u5e76\u6839\u636e\u7ed3\u679c\u505a\u4e0d\u540c\u7684\u5904\u7406\u3002<br \/>\u8fd9\u91cc\u5c31\u9700\u8981\u4e00\u4e2a ref \u6765\u7f13\u5b58\u65e7\u7684 props\uff0c\u7528 useState \u7684\u8bdd\u4f1a\u9020\u6210\u989d\u5916\u7684\u6e32\u67d3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679614\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : pkupyx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5386\u53f2\u6765\u770b\uff0c\u7c7b\u4f3c\u4e8e jQuery \u7684$(&#8220;xxx&#8221;)\uff0c\u4e3b\u8981\u662f\u6709\u4e9b\u64cd\u4f5c\u4f8b\u5982 scrollView.scrollTo({x,y});\u5e76\u4e0d\u662f\u5f88\u65b9\u4fbf\u901a\u8fc7&lt; scrollToX={x}&gt;\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\uff0c\u6240\u4ee5\u7559\u4e86 ref \u6765\u83b7\u53d6 react \u7684 node \u7684\u5f15\u7528\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5679615\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : MikeLei <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5f15\u7528\u4f20\u9012\u53c2\u6570,\u4f8b\u5982:<\/p>\n<p>int a =20;<\/p>\n<p>this.methodByRef(ref a);<\/p>\n<p>Console.WriteLine(&#8220;a={0}&#8221;,a);<\/p>\n<p>public void methodByRef(ref int a){<\/p>\n<p> a=100;<\/p>\n<p>}<\/p>\n<p>\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/p>\n<p>\u8f93\u51fa\u7ed3\u679c\u662f:a=100;                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3b\u4e00\u76f4\u6ca1\u6709\u5f04\u660e\u767d\uff0c\u90a3\u4e2a ref \u5bf9&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/432028"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=432028"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/432028\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=432028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=432028"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=432028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}