Jon*_*Sud 7 css sass vue.js vuetify.js
我正在使用 scss 文件,我想更改 vuetify v2 中 css 端的断点。
我在 vuetify 升级指南中找不到任何参考资料。
在 1.5 版中,我做了 style-x.styl:
$grid-breakpoints := {
xs: 0
sm: 476px
md: 668px
lg: 1000px
xl: 1300px
}
@import '~vuetify/src/styles/styles.sass';
$material-light.background = #f5f5f5;
@import '~vuetify/src/stylus/main';
Run Code Online (Sandbox Code Playgroud)
然后我导入文件:
import '../style-x.styl';
...
Vue.use(Vuetify);
...
Run Code Online (Sandbox Code Playgroud)
Ale*_*kov 10
所以看看文档:https : //vuetifyjs.com/en/customization/sass-variables/#vue-cli-install,它说:
安装后,在您的 src 目录中创建一个名为 sass、scss 或 style 的文件夹,并使用名为 variables.scss 或 variables.sass 的文件
也就是说,在我们使用Vue CLI创建项目后,我们手动:
*
$grid-breakpoints: (
xs: 0,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px
);
Run Code Online (Sandbox Code Playgroud)
For version 2.0 you have to change the SASS variables by creating a custom SASS file which you import into your vue.config.js file: https://vuetifyjs.com/en/customization/sass-variables.
For the SASS variables to be available globally, you can to first
// src/sass/main.scss
@import '~vuetify/src/styles/styles.sass';
// You need to map-merge your new SASS variables
$grid-breakpoints: map-merge($grid-breakpoints, (
xs: 0,
sm: 476px,
md: 668px,
lg: 1000px,
xl: 1300px
))
Run Code Online (Sandbox Code Playgroud)
And then have your config file import the variable globally:
// vue.config.js
module.exports = {
css: {
loaderOptions: {
sass: {
data: `@import "~@/sass/main.scss"`,
},
},
},
}
Run Code Online (Sandbox Code Playgroud)
当您指定 Vuetify 选项时,您还必须指定您的自定义断点:https ://vuetifyjs.com/en/customization/breakpoints
//import this into your main.js
import Vue from 'vue'
import Vuetify from 'vuetify/lib'
export default new Vuetify({
breakpoint: {
thresholds: {
xs: 0,
sm: 476,
md: 668,
lg: 1000,
xl: 1300
}
}
})
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5590 次 |
最近记录: |