Vue introduces public css files

1. Introduced in the entry js file main.js, some public style files can be imported here.

import Vue from 'vue'
 import App from './App' // import the App component
 import router from './router' /* import routing configuration*/
 import axios from 'axios'
 import '../static/css/ global.css' /*Introduce public styles*/
2. Introduce in 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. Introduced in app.vue, but there is a problem with this introduction, that is, there will be an empty <style></style> on the HEADH of index.html

<template>
  <div id="app">
    <router-view/>
  </div>
</template>
<script>
export default {
  name: 'app'
}
</script>
<style>
@import './../static/css/global.css'; /*引入公共样式*/

  

</style>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324839943&siteId=291194637