我是Vue的新手,在理解things在Vue中的工作方式时遇到了问题,其中一个问题是在项目中包含了我自己的自定义CSS文件。
我在src文件夹中创建了style.css文件,index.html中的代码对我不起作用:
<link rel="stylesheet" type="text/css" href="style.css" />
我不得不在main.js文件中导入样式,并复制整个路径
'/home/timotej/Desktop/TestProjekt/projekt/src/style.css'
因此整个main.js文件看起来是这样的:
import Vue from 'vue'
import App from './App.vue'
import style from '/home/timotej/Desktop/TestProjekt/projekt/src/style.css' // styles ..
Vue.use(style) // styles ..
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')
现在它应该工作了!