zoukankan      html  css  js  c++  java
  • vue 引入公共css文件

    1、在入口js文件main.js中引入,一些公共的样式文件,可以在这里引入。

    import Vue from 'vue'
    import App from './App' // 引入App这个组件
    import router from './router' /* 引入路由配置 */
    import axios from 'axios'
    import '../static/css/global.css' /*引入公共样式*/

    2、在index.html中引入

    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <title>stop</title>
        <link rel="stylesheet" href="./static/css/global.css"> /*引入公共样式*/

      </head>
      <body>
        <div id="app"></div>
        <!-- built files will be auto injected -->
      </body>
    </html>

    3、在app.vue中引入,但是这样引入有一个问题,就是在index.html的HEADH上会多出一个空的<style></style>

    <template>
      <div id="app">
        <router-view/>
      </div>
    </template>

    <script>
    export default {
      name: 'app'
    }
    </script>

    <style>
      @import './../static/css/global.css'; /*引入公共样式*/

    </style>

  • 相关阅读:
    12-29 批量删除
    12-29 注册审核
    12-25造数据库面向对象
    12-23 会话保持
    2016-12-19 php修改数据库数据
    12-18数据访问
    12-16php测试题
    1027 制作表格
    1027 超链接
    1027 HTML
  • 原文地址:https://www.cnblogs.com/wpcnblog/p/10973573.html
Copyright © 2011-2022 走看看