久久久久久久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>

                            主站蜘蛛池模板: 91久久国产综合久久91精品网站 | 国产日韩欧美91 | 欧美日韩高清在线一区 | 亚洲精品视频在线播放 | 欧美精品一区二区三区在线 | 精品国产成人 | 涩涩视频在线看 | 精品免费国产一区二区三区四区介绍 | 久久一区二区三区四区 | 国产激情视频在线免费观看 | 久久久久久国产精品 | 久久久久久久综合色一本 | 国产视频一区二区 | 国产成人精品免费视频大全最热 | 欧美激情综合五月色丁香小说 | 日韩综合在线播放 | 免费一级淫片aaa片毛片a级 | 福利视频一区二区 | 福利片在线看 | 国产精品久久久久久久久久不蜜臀 | 91精品国产综合久久久亚洲 | 在线观看亚洲专区 | 黄片毛片在线观看 | 亚洲国产片 | 国产精品久久久久久吹潮 | 丁香婷婷在线视频 | 久久精品一级 | 国产三级一区二区 | 亚洲精品视频免费看 | 91精品国产综合久久久久 | 国产精品美女久久久久久不卡 | 亚洲高清中文字幕 | 中文字幕一区在线观看视频 | 一区二区精品 | 亚洲www啪成人一区二区 | 国产欧美一区二区三区在线看 | 亚洲一区二区三区四区av | av国产精品| 欧美日韩国产高清视频 | 欧美日韩一区二区三区四区五区 | 久久国产精品99久久久久 |