zoukankan      html  css  js  c++  java
  • react link引入外部css样式的坑

    刚开始的代码是这样的,使用react router4.x写的demo路由跳转后,页面的没有渲染,是因为没有引入外部css文件(或者说引入外部文件路径错误)

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta name="theme-color" content="#000000">
        <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
        <title>React App</title>
        
        <link rel="stylesheet" href="./css/bootstrap.css">
      </head>
      <body>
        <noscript>
          You need to enable JavaScript to run this app.
        </noscript>
        <div id="root"></div>
      </body>
    </html>
    

     将上面代码(红色部分)的点去掉就可以了,如下所示

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta name="theme-color" content="#000000">
        <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
        <title>React App</title>
        
        <link rel="stylesheet" href="/css/bootstrap.css">
      </head>
      <body>
        <noscript>
          You need to enable JavaScript to run this app.
        </noscript>
        <div id="root"></div>
      </body>
    </html>
    
  • 相关阅读:
    web接口调用
    UISegmentedControl
    CocoaPods安装和使用教程
    NSTimeInterval
    OC-NSString从文件中读取字符串
    XMPP(mac)方案二 ejabberd 服务器搭建 (转载)
    监听 IOS响应式编程框架ReactiveCocoa(RAC)使用示例(转载)
    iOS开发-文件管理
    OC中NSString 的常用方法 (转载)
    NSAttributedString
  • 原文地址:https://www.cnblogs.com/xinzaimengzai/p/9952999.html
Copyright © 2011-2022 走看看