1. mixin.scss// Color definition specification $color-background : #FFFFFF; $color-background-d : rgba(0, 0, 0, 0.3); $color-highlight-background : #333; $color-dialog-background : #666; $color-theme : #ffcd32; $color-theme-d : rgba(255, 205, 49, 0.5); $color-sub-theme : #d93f30; $color-text-d : rgba(255, 255, 255, 0.3); $color-text-l : rgba(255, 255, 255, 0.5); $color-text-ll : rgba(255, 255, 255, 0.8); $font-gray : #999; //Font definition specification $font-size-small-s : 10px; $font-size-small : 12px; $font-size-medium : 14px; $font-size-medium-x : 16px; $font-size-large : 18px; $font-size-large-x : 22px; $font-weight : 600; body,html{ //background: rgb(239, 242, 249); } //Background image 100% @mixin bkgMaxSize($url) { background-image: url($url); background-repeat: no-repeat; background-size: 100% 100%; } @mixin font-setting-group($font-size,$font-family,$font-weight,$color,$line-height){ font-size: $font-size; font-family: $font-family; font-weight: $font-weight; color: $color; line-height: $line-height; } //Border radius @mixin borderRadius($radius) { -webkit-border-radius: $radius; -moz-border-radius: $radius; -ms-border-radius: $radius; -o-border-radius: $radius; border-radius: $radius; } //Positioning up, down, left, and right in the center @mixin positionCenter { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } // Positioning up and down center @mixin ct { position: absolute; top: 50%; transform: translateY(-50%); } // Position left and right center @mixin cl { position: absolute; left: 50%; transform: translateX(-50%); } // Positioning full screen @mixin allcover { position: absolute; top: 0; right: 0; } //Relative positioning @mixin my-absolute($left, $top,$z) { position: absolute; z-index: $z; margin-left: $left; margin-top: $top; } //Different width and height @mixin widthHeightN($width, $height){ width: $width; height: $height; } //Width and height - same @mixin widthHeightY($number){ width: $number; height: $number; } //font size, color @mixin sizeColor($size, $color){ font-size: $size; color: $color; } //flex layout @mixin center_none{ display: flex; justify-content: center; align-items: center; } @mixin center_center{ display: flex; justify-content: center; align-items: center; } @mixin flex-start_center{ display: flex; justify-content: flex-start; align-items: center; } @mixin space-between_center{ display: flex; justify-content: space-between; align-items: center; } @mixin space-around_center{ display: flex; justify-content: space-around; align-items: center; } @mixin flex-end_center{ display: flex; justify-content: flex-end; align-items: center; } @mixin wrap_flex-start{ display: flex; flex-wrap:wrap; align-content:flex-start; } @mixin flex-start_column{ display: flex; justify-content: flex-start; flex-direction: column; } @mixin none_center_column{ display: flex; align-items: center; flex-direction: column; } @mixin center_center_column{ display: flex; align-items: center; justify-content: flex-start; flex-direction: column; } This file is the globally encapsulated 2. Single file usage3. Global Mount3.1 Import Dependenciesnpm install sass-resources-loader Add configuration: Add the following code to the module.exports = { outputDir: 'mbb',/*output directory*/ publicPath: '/',/*Access prefix*/ lintOnSave: false, // Turn off Eslint detection chainWebpack: config => { const oneOfsMap = config.module.rule('scss').oneOfs.store oneOfsMap.forEach(item => { item .use('sass-resources-loader') .loader('sass-resources-loader') .options({ // Provide path to the file with resources // The path of the scss to be shared resources: 'src/assets/stylus/mixin.scss' }) .end() }) } } chainWebpack chunk 3.2 Restart the projectThis is the end of this article about vue's global introduction of scss (mixin). For more relevant vue's global introduction of scss content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Solve the compatibility issue between MySQL 8.0 driver and Alibaba Druid version
>>: Several ways to hide Html elements
I would like to ask a question. In Dreamweaver, I...
This article shares the specific code of the WeCh...
Edit docker-compose.yml and add the following con...
Table of contents Step 1: Installation Step 2: Ci...
Regarding the issue of MySQL remote connection, w...
You need to apply CSS to div or span at the same t...
Table of contents Prepare Five weapons for…in Obj...
1. Transactions have ACID characteristics Atomici...
This article example shares the specific code of ...
I struggled with a problem for a long time and re...
Preface By default, MySQL will initialize a large...
1 Introduction When designing a database, it is i...
Limit input box to only pure numbers 1、onkeyup = ...
Given a div with the following background image: ...
If you’re new to Docker, take a look at some of t...