5

我正在尝试将Element UI添加到我的 Vue 应用程序中。我遵循快速入门教程,我有我的 application.js

import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/it'
import App from '../app.vue'

Vue.use(ElementUI, { locale })

document.addEventListener('DOMContentLoaded', () => {
  document.body.appendChild(document.createElement('app'))
  const app = new Vue(App).$mount('app')

  console.log(app)
})

我正在导入 CSS,我也有

<%= stylesheet_link_tag 'application' %>

在我的布局里面,但是这个文件是空的,没有样式。该应用程序正在运行,但没有 CSS。我的错在哪里?

4

1 回答 1

4

问题出在导入方法中

利用

<%= stylesheet_pack_tag 'application', media: 'all' %>

代替

<%= stylesheet_link_tag 'application' %>

基于:https ://github.com/rails/webpacker/issues/987

于 2018-01-18T17:10:28.513 回答