-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lkd
committed
Feb 21, 2019
1 parent
b48e041
commit 668bb2a
Showing
18 changed files
with
11,804 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
> 1% | ||
last 2 versions | ||
not ie <= 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.DS_Store | ||
node_modules | ||
/dist | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# responsive-element | ||
开箱即用的`element-ui`响应式模板,基于`vue-cli 3`搭建,使用`webpack 4`,更多配置见[配置参考](https://cli.vuejs.org/zh/config/)。 | ||
|
||
### 响应式思路 | ||
通过`pxtorem`将`element-ui`中的单位转为`rem`以配合响应式。 | ||
|
||
### 项目配置 | ||
- 安装依赖 | ||
``` | ||
npm install | ||
``` | ||
|
||
#### 配置响应式 | ||
- 文件目录 `public/index.html` | ||
|
||
``` | ||
const designWidth = 1920 // 设计稿宽度 1920px | ||
const rem2px = 100 // rem基数 1rem = 100px 基数请与wepack中pxtorem的rootValue保持一致 | ||
``` | ||
|
||
#### 配置`pxtorem` | ||
- 文件目录: `./vue.config.js` | ||
|
||
``` | ||
// 将element px转换为rem | ||
css: { | ||
loaderOptions: { | ||
postcss: { | ||
plugins: [ | ||
autoprefixer(), | ||
pxtorem({ | ||
rootValue: 100, // 基数请与 public/index.html 中的rem2px保持一致 | ||
propList: ['*'] | ||
}) | ||
] | ||
} | ||
} | ||
}, | ||
``` | ||
|
||
### :rocket:启动项目(开发环境) | ||
``` | ||
npm run dev | ||
``` | ||
|
||
### 编译项目(生成环境) | ||
``` | ||
npm run build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = { | ||
presets: [ | ||
'@vue/app' | ||
], | ||
plugins: [ | ||
[ | ||
"component", | ||
{ | ||
"libraryName": "element-ui", // 按需引入element-ui组件 | ||
"styleLibraryName": "theme-chalk" // 默认主题 | ||
} | ||
] | ||
] | ||
} |
Oops, something went wrong.