mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
1.0 KiB
1.0 KiB
Advanced Usage
Browser adaptation
Rem Units
Vant uses px
unit by default,you can use tools such as postcss-pxtorem
to transform units to rem
.
PostCSS Config
Postcss config example:
module.exports = {
plugins: {
autoprefixer: {
browsers: ['Android >= 4.0', 'iOS >= 8'],
},
'postcss-pxtorem': {
rootValue: 37.5,
propList: ['*'],
},
},
};
Adapt to PC Browsers
Vant is a mobile-first component library, if you want to use Vant in PC browsers, you can use the @vant/touch-emulator module. This module will automatically convert the mouse events of the PC browser into the touch events of the mobile browser.
# Install
npm i @vant/touch-emulator -S
// Just import this module, then Vant works in PC browser
import '@vant/touch-emulator';