久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <i id='fM6Qv'><tr id='fM6Qv'><dt id='fM6Qv'><q id='fM6Qv'><span id='fM6Qv'><b id='fM6Qv'><form id='fM6Qv'><ins id='fM6Qv'></ins><ul id='fM6Qv'></ul><sub id='fM6Qv'></sub></form><legend id='fM6Qv'></legend><bdo id='fM6Qv'><pre id='fM6Qv'><center id='fM6Qv'></center></pre></bdo></b><th id='fM6Qv'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='fM6Qv'><tfoot id='fM6Qv'></tfoot><dl id='fM6Qv'><fieldset id='fM6Qv'></fieldset></dl></div>
      <bdo id='fM6Qv'></bdo><ul id='fM6Qv'></ul>

  • <legend id='fM6Qv'><style id='fM6Qv'><dir id='fM6Qv'><q id='fM6Qv'></q></dir></style></legend>
  • <tfoot id='fM6Qv'></tfoot>

      <small id='fM6Qv'></small><noframes id='fM6Qv'>

      1. 如何從 React 訪問樣式?

        How to Access styles from React?(如何從 React 訪問樣式?)

          <tbody id='sX7OD'></tbody>
        <tfoot id='sX7OD'></tfoot>

          <i id='sX7OD'><tr id='sX7OD'><dt id='sX7OD'><q id='sX7OD'><span id='sX7OD'><b id='sX7OD'><form id='sX7OD'><ins id='sX7OD'></ins><ul id='sX7OD'></ul><sub id='sX7OD'></sub></form><legend id='sX7OD'></legend><bdo id='sX7OD'><pre id='sX7OD'><center id='sX7OD'></center></pre></bdo></b><th id='sX7OD'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='sX7OD'><tfoot id='sX7OD'></tfoot><dl id='sX7OD'><fieldset id='sX7OD'></fieldset></dl></div>

            • <legend id='sX7OD'><style id='sX7OD'><dir id='sX7OD'><q id='sX7OD'></q></dir></style></legend>
                  <bdo id='sX7OD'></bdo><ul id='sX7OD'></ul>

                  <small id='sX7OD'></small><noframes id='sX7OD'>

                • 本文介紹了如何從 React 訪問樣式?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我試圖在 React 中訪問 div 的寬度和高度樣式,但我遇到了一個問題.這是我到目前為止得到的:

                  componentDidMount() {console.log(this.refs.container.style);}使成為()  {返回 (<div ref={"container"} className={"container"}></div>//設置參考);}

                  這可行,但我得到的輸出是一個 CSSStyleDeclaration 對象,在 all 屬性中,我可以為該對象設置所有 CSS 選擇器,但它們都沒有設置.它們都設置為空字符串.

                  這是 CSSStyleDecleration 的輸出:http://pastebin.com/wXRPxz5p

                  任何有關查看實際樣式(事件繼承的樣式)的幫助將不勝感激!

                  謝謝!

                  解決方案

                  For React v <= 15

                  console.log(ReactDOM.findDOMNode(this.refs.container).style);//反應 v >0.14console.log(React.findDOMNode(this.refs.container).style);//React v <= 0.13.3

                  <塊引用>

                  用于獲取具體的樣式值

                  console.log(window.getComputedStyle(ReactDOM.findDOMNode(this.refs.container)).getPropertyValue("border-radius"));//border-radius 可以替換為任何其他樣式屬性;

                  <塊引用>

                  對于反應 v>= 16

                  使用回調樣式或使用 createRef() 分配 ref.

                  assignRef = element =>{this.container = 元素;}getStyle = () =>{常量樣式 = this.container.style;控制臺.log(樣式);//用于獲取計算樣式const computed = window.getComputedStyle(this.container).getPropertyValue("border-radius"));//border-radius 可以替換為任何其他樣式屬性;控制臺.log(計算);}

                  I am trying to access the width and height styles of a div in React but I have been running into one problem. This is what I got so far:

                  componentDidMount()  {
                    console.log(this.refs.container.style);     
                  }
                  
                  
                  render()  {
                     return (
                        <div ref={"container"} className={"container"}></div>  //set reff
                     );
                  }
                  

                  This works but the output that I get is a CSSStyleDeclaration object and in the all property I can all the CSS selectors for that object but they none of them are set. They are all set to an empty string.

                  This is the output of the CSSStyleDecleration is: http://pastebin.com/wXRPxz5p

                  Any help on getting to see the actual styles (event inherrited ones) would be greatly appreciated!

                  Thanks!

                  解決方案

                  For React v <= 15

                  console.log( ReactDOM.findDOMNode(this.refs.container).style); //React v > 0.14
                  
                  console.log( React.findDOMNode(this.refs.container).style);//React v <= 0.13.3
                  

                  EDIT:

                  For getting the specific style value

                  console.log(window.getComputedStyle(ReactDOM.findDOMNode(this.refs.container)).getPropertyValue("border-radius"));// border-radius can be replaced with any other style attributes;
                  

                  For React v>= 16

                  assign ref using callback style or by using createRef().

                  assignRef = element => {
                    this.container = element;
                  }
                  getStyle = () => {
                  
                    const styles = this.container.style;
                    console.log(styles);
                    // for getting computed styles
                    const computed = window.getComputedStyle(this.container).getPropertyValue("border-radius"));// border-radius can be replaced with any other style attributes;
                    console.log(computed);
                  }
                  

                  這篇關于如何從 React 訪問樣式?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)
                • <small id='QlyXc'></small><noframes id='QlyXc'>

                  1. <legend id='QlyXc'><style id='QlyXc'><dir id='QlyXc'><q id='QlyXc'></q></dir></style></legend>
                    • <i id='QlyXc'><tr id='QlyXc'><dt id='QlyXc'><q id='QlyXc'><span id='QlyXc'><b id='QlyXc'><form id='QlyXc'><ins id='QlyXc'></ins><ul id='QlyXc'></ul><sub id='QlyXc'></sub></form><legend id='QlyXc'></legend><bdo id='QlyXc'><pre id='QlyXc'><center id='QlyXc'></center></pre></bdo></b><th id='QlyXc'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QlyXc'><tfoot id='QlyXc'></tfoot><dl id='QlyXc'><fieldset id='QlyXc'></fieldset></dl></div>
                    • <tfoot id='QlyXc'></tfoot>

                        <bdo id='QlyXc'></bdo><ul id='QlyXc'></ul>
                          <tbody id='QlyXc'></tbody>

                            主站蜘蛛池模板: 欧美激情国产日韩精品一区18 | 欧区一欧区二欧区三免费 | 精品一区二区三区在线观看 | 国产亚洲一区二区三区 | 久久成人免费视频 | av一区二区三区四区 | 91黄色片免费看 | 亚洲综合小视频 | 一级毛片视频免费观看 | 国产在线激情视频 | 亚洲精品视 | 美女天天操 | 99热精品在线 | 日韩成人专区 | 99亚洲精品 | 黄色电影在线免费观看 | 国产一区二区激情视频 | 国产美女在线播放 | 久久久久成人精品免费播放动漫 | 亚洲欧美精品久久 | 成人午夜免费视频 | 国产一区二区电影网 | 欧美日韩久久精品 | 国产一区二区电影 | 美日韩中文字幕 | 欧美日韩国产精品激情在线播放 | 亚洲一区二区三区视频 | 日韩精品一区二区三区在线播放 | 一区二区三区韩国 | 中文成人在线 | 精品视频一区在线 | 在线观看中文字幕一区二区 | 在线免费观看黄视频 | 久久伊 | 久优草 | 亚洲精品第一页 | 日韩中字幕 | 久久久久久久久久久一区二区 | 国产精品日韩欧美 | 免费黄视频网站 | 国产精品视频播放 |