zoukankan      html  css  js  c++  java
  • React(JSX语法)----JSX拼写

    注意:For DOM differences,such as the inline style attribute,check here.

    // bad: it displays "FIrst · second" 
    <div>{'First &middot; Second'}</div>

      There are various ways to work-around this issue.The easiest one is to write unicode cahracter directly in JavaScript.You need to make sure the file is saved as UTF-8 and that the proper UTF-8 directive are set so the brower will display it correctly.

    <div>{'First u00b7 Second'}</div>
    <div>{'First' + String.fromCharCode(183) + 'Second'}</div>
    

      

    <div>{['First',<span>·</span>,'Second']}</div>
    

      

    <div dangerouslySetInnerHTML = {{__html:'First · Second'}}>
    

     

      if you pass properties to native HTML elements that do not exist in the HTML specification,React will not render them. if you want to use a custom attribute,you should prefix it with data-

    <div data-custom-attribute = "foo">
    

      web Accessibility attributes starting with aria- will be rendered properly.

    <div aria-hidden = {true}>
    

      

  • 相关阅读:
    软件工程第三次作业
    软件工程第一次作业
    软件工程第0次作业
    第2次作业
    第1次作业
    第0次作业
    软件工程第四次作业 石墨文档IOS
    软件工程第三次作业
    软件工程第一次作业
    第零次作业
  • 原文地址:https://www.cnblogs.com/jodie-blog/p/5110846.html
Copyright © 2011-2022 走看看