Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问在现有工程里如何引入组件和样式 #188

Open
net592 opened this issue Apr 20, 2021 · 1 comment
Open

请问在现有工程里如何引入组件和样式 #188

net592 opened this issue Apr 20, 2021 · 1 comment

Comments

@net592
Copy link

net592 commented Apr 20, 2021

请问大佬在现有工程里如何引入组件和样式
1.项目根目录下运行:npm i noahv-components --save
2.main.js 中import引入并调用Vue.use,参考noahv-component的引入。
目前 缺少相关样式,无法显示完整,是否需要手动导入样式less? import /noahv-component/src/assets/css/index.less

@net592
Copy link
Author

net592 commented Apr 20, 2021

已自行解决;祝好,项目vue版本组件较老,引入注意
// 1. main.js 全局引入模板和CSS样式
// 2. 之前项目如果没有less, 需要安装less 版本(以下版本可用,高版本有问题) npm install less-loader@^4.0.0 less@^2.7.3 -D

// 第一项 配置 mian.js使用iView模板

// 使用iView模板
import iView from 'iview';
Vue.use(iView);
// import iview style
import 'iview/src/styles/index.less';


// 使用NoahV模板
import noahvComponent from 'noahv-component';
Vue.use(noahvComponent);
// import noahv style
import 'noahv-component/src/assets/css/index.less';

// 第二项 配置 ps 如果要使用less 3.x 版本需要 注释 vue.config.js 增加
module.exports = { ... css: { loaderOptions: { less: { javascriptEnabled: true, } } } ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant