久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      react 怎么設(shè)置 style屬性

      react設(shè)置style屬性的方法:1、通過“<div style={{padding: '2px 0 5px 20px',overflowY: 'auto'}}>”方式設(shè)置行內(nèi)樣式;2、通過“height: 'calc(100% – 15px)'”設(shè)置百分比;3、通過在樣式中使用函數(shù)“getWinHeight(200)”設(shè)置屬性即可。

      react 怎么設(shè)置 style屬性

      本教程操作環(huán)境:Windows10系統(tǒng)、react18.0.0版、Dell G3電腦。

      react 怎么設(shè)置 style屬性?

      React中設(shè)置樣式style

      1.設(shè)置行內(nèi)樣式:

      1.基本設(shè)置:

      使用{},傳入一個(gè)對(duì)象{padding: '2px 0 5px 20px',overflowY: 'auto'}

      如下所示:

      <div style={{padding: '2px 0 5px 20px',overflowY: 'auto'}}
      登錄后復(fù)制

      2.設(shè)置百分比(相對(duì)數(shù)據(jù))

      <div style={{width: 'calc(100% - 35px)',height: 'calc(100% - 15px)'}}>
      登錄后復(fù)制

      3.通過函數(shù)設(shè)置:

      例如,自己寫一個(gè)計(jì)算window高度的函數(shù):

      //參數(shù) adjustValue的作用是在window.innerHeight的基礎(chǔ)上,減去多少高度,可以是負(fù)值,0,正值 function getWinHeight(adjustValue) {     let winHeight;     if (window.innerHeight) {       winHeight = window.innerHeight;     } else if ((document.body) && (document.body.clientHeight)) {       winHeight = document.body.clientHeight;     }     return winHeight-adjustValue;   }
      登錄后復(fù)制

      然后在樣式中使用:

      <div style={{width: 'calc(100% - 35px)',height: getWinHeight(200)}}>     <div id="jsoneditor" className="jsoneditor-react-container"  /> </div>
      登錄后復(fù)制

      2.雜七雜八:

      1.table占滿整行:

      設(shè)置table標(biāo)簽的style 為 style={{width: 'calc(100% – 10px)'}}

      <table style={{width: 'calc(100% - 10px)'}}>   <tr>     <td style={{width:'50px'}}>       <div style={{paddingTop:"10px",marginLeft:'10px'}}>         <Button           id="returnButtonId"           text=""           icon={"ic_arrow_back"}           onClick={doBack}         />       </div>     </td>     <td>       <div style={{paddingTop:'10px'}}>Edit Parameter Files</div>     </td>     <td>       <div style={{float:'right', margin:'0 10px 0 10px', paddingTop:'10px'}}>         <Button             id="`uploadButtonId`"             text="UPLOAD"             icon={"ic_arrow_upward"}             onClick={onUploadClicked}         />       </div>     </td>   </tr> </table>
      登錄后復(fù)制

      2.父 <div>設(shè)置高度不起作用:

      如果父<div>設(shè)置高度不管用,那么必須將子<div>的高度也設(shè)置一下,可以跟父<div>的高度保持一致,.

      入下圖所示:父子<div>的高度都被設(shè)置為 getWinHeight(180)

            <div style={{height: getWinHeight(180), border:'2px'}}>           <SplitScreen             id="parameterfiles-panel"             left={               <div style={{height: getWinHeight(180)}}>               ..........               </div>             }             right={               <div style={{ whiteSpace: "nowrap"}}>                   <div style={{padding: '2px 0 5px 20px',overflowY: 'auto', width: 'calc(100% - 35px)',height: getWinHeight(180)}}>                     <div id="jsoneditor" className="jsoneditor-react-container"  />                   </div>               </div>             }           />         </div>
      登錄后復(fù)制

      暫時(shí)寫這么多,以后想到別的,再寫。

      推薦學(xué)習(xí):《react視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)