Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

关于 element 按需引入独立成单独文件的样式问题

如下是我的 main.js 配置

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './lib/global.less'
import {
  Popover,
} from 'element-ui'
Vue.use(Popover)
Vue.config.productionTip = false

把 element-ui 单独抽离成 element.js

import Vue from 'vue'
import {
  Popover,
} from 'element-ui'
Vue.use(Popover)

然后再 main.js 引入 element.js

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './lib/global.less'
import './element.js'
Vue.config.productionTip = false

结果 样式有问题 求大佬指教 写法哪里有问题

后来发现直接引入 element.js 会覆盖掉自己写的样式(在单独的页面 不在 global.less)
如果在 main.js 直接一行行写代码就不会覆盖
同样的位置引入的 为什么会有区别呢?
问题找到了 但是不知道什么原因~求大佬一起分享


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

global.less有没有一些全局的样式影响了,要么更新一下版本试试


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...