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>
    
  • 相关阅读:
    Linux内核调试方法总结之ftrace
    Linux内核调试方法总结之ptrace
    Linux内核调试方法总结之ltrace
    文件处理
    python基础之字符编码
    第三篇:python基础之数据类型与变量
    第二篇:python基础之核心风格
    数据类型、字符编码、文件处理
    python入门
    爬取加载页面数据
  • 原文地址:https://www.cnblogs.com/xinzaimengzai/p/9952999.html
Copyright © 2011-2022 走看看