# vant **Repository Path**: lzptg/vant ## Basic Information - **Project Name**: vant - **Description**: vant组件使用 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-12-27 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # vant ## 安装步骤 ``` 1.vue脚手架工具初始化 2.cnpm i vant -S 安装vant组件 3.cnpm i babel-plugin-import -D 调用按需引入 3.1 在babel.config.js中做配置 plugins: [ ['import', { libraryName: 'vant', libraryDirectory: 'es', style: true, }, 'vant'], ], 4.根目录新建vue.config.js文件 5.0 配置rem 5.1 cnpm i -S amfe-flexible 在main.js中引入 5.2 cnpm i -S autoprefixer 5.3 cnpm i -D postcss-pxtorem // vue.config.js const autoprefixer = require('autoprefixer'); const pxtorem = require('postcss-pxtorem'); module.exports = { baseUrl: process.env.NODE_ENV === 'production' ? '/production-sub-path/' : '/', devServer: { port: 8098, open: false, }, // lintOnSave: true, css: { loaderOptions: { postcss: { plugins: [ autoprefixer(), // 自动加前缀 pxtorem({ rootValue: 75, // 换算的基数 selectorBlackList: ['van'], // 忽略转换正则匹配项 propList: ['*'], // 需要做转化处理的属性,如`hight`、`width`、`margin`等,`*`表示全部 }), ], }, }, }, }; ``` ## Project setup ``` yarn install ``` ### Compiles and hot-reloads for development ``` yarn run serve ``` ### Compiles and minifies for production ``` yarn run build ``` ### Run your tests ``` yarn run test ``` ### Lints and fixes files ``` yarn run lint ```