From 3466b9feb2ab86994e37264cc5da40c2d54a7d36 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 30 Jun 2017 11:31:21 +0800 Subject: [PATCH 1/2] fix postcss bug --- .postcssrc.js | 8 ++++ build/utils.js | 106 +++++++++++++++++++++--------------------- src/App.vue | 4 ++ src/main.js | 3 +- src/styles/index.scss | 3 +- 5 files changed, 67 insertions(+), 57 deletions(-) create mode 100644 .postcssrc.js diff --git a/.postcssrc.js b/.postcssrc.js new file mode 100644 index 00000000..ea9a5ab8 --- /dev/null +++ b/.postcssrc.js @@ -0,0 +1,8 @@ +// https://github.com/michael-ciniawsky/postcss-load-config + +module.exports = { + "plugins": { + // to edit target browsers: use "browserlist" field in package.json + "autoprefixer": {} + } +} diff --git a/build/utils.js b/build/utils.js index d3aaebb0..b1d54b4d 100644 --- a/build/utils.js +++ b/build/utils.js @@ -3,69 +3,69 @@ var config = require('../config') var ExtractTextPlugin = require('extract-text-webpack-plugin') exports.assetsPath = function (_path) { - var assetsSubDirectory = process.env.NODE_ENV === 'production' - ? config.build.assetsSubDirectory - : config.dev.assetsSubDirectory - return path.posix.join(assetsSubDirectory, _path) + var assetsSubDirectory = process.env.NODE_ENV === 'production' + ? config.build.assetsSubDirectory + : config.dev.assetsSubDirectory + return path.posix.join(assetsSubDirectory, _path) } exports.cssLoaders = function (options) { - options = options || {} + options = options || {} - var cssLoader = { - loader: 'css-loader', - options: { - minimize: process.env.NODE_ENV === 'production', - sourceMap: options.sourceMap - } + var cssLoader = { + loader: 'css-loader', + options: { + minimize: process.env.NODE_ENV === 'production', + sourceMap: options.sourceMap + } + } + + // generate loader string to be used with extract text plugin + function generateLoaders (loader, loaderOptions) { + var loaders = [cssLoader] + if (loader) { + loaders.push({ + loader: loader + '-loader', + options: Object.assign({}, loaderOptions, { + sourceMap: options.sourceMap + }) + }) } - // generate loader string to be used with extract text plugin - function generateLoaders(loader, loaderOptions) { - var loaders = [cssLoader] - if (loader) { - loaders.push({ - loader: loader + '-loader', - options: Object.assign({}, loaderOptions, { - sourceMap: options.sourceMap - }) - }) - } - - // Extract CSS when that option is specified - // (which is the case during production build) - if (options.extract) { - return ExtractTextPlugin.extract({ - use: loaders, - fallback: 'vue-style-loader' - }) - } else { - return ['vue-style-loader'].concat(loaders) - } + // Extract CSS when that option is specified + // (which is the case during production build) + if (options.extract) { + return ExtractTextPlugin.extract({ + use: loaders, + fallback: 'vue-style-loader' + }) + } else { + return ['vue-style-loader'].concat(loaders) } + } - // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html - return { - css: generateLoaders(), - postcss: generateLoaders(), - less: generateLoaders('less'), - sass: generateLoaders('sass', {indentedSyntax: true}), - scss: generateLoaders('sass'), - stylus: generateLoaders('stylus'), - styl: generateLoaders('stylus') - } + // https://vue-loader.vuejs.org/en/configurations/extract-css.html + return { + css: generateLoaders(), + postcss: generateLoaders(), + less: generateLoaders('less'), + sass: generateLoaders('sass', { indentedSyntax: true }), + scss: generateLoaders('sass'), + stylus: generateLoaders('stylus'), + styl: generateLoaders('stylus') + } } // Generate loaders for standalone style files (outside of .vue) exports.styleLoaders = function (options) { - var output = [] - var loaders = exports.cssLoaders(options) - for (var extension in loaders) { - var loader = loaders[extension] - output.push({ - test: new RegExp('\\.' + extension + '$'), - use: loader - }) - } - return output + var output = [] + var loaders = exports.cssLoaders(options) + for (var extension in loaders) { + var loader = loaders[extension] + output.push({ + test: new RegExp('\\.' + extension + '$'), + use: loader + }) + } + return output } diff --git a/src/App.vue b/src/App.vue index 823cad8a..61ed51d4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -9,3 +9,7 @@ name: 'APP' } + + diff --git a/src/main.js b/src/main.js index 7656d8de..5f6bb26d 100644 --- a/src/main.js +++ b/src/main.js @@ -6,11 +6,10 @@ import router from './router'; import store from './store'; import ElementUI from 'element-ui'; import 'element-ui/lib/theme-default/index.css'; -import 'assets/custom-theme/index.css'; // 换肤版本element-ui css https://github.com/PanJiaChen/custom-element-theme +import 'assets/custom-theme/index.css'; // 换肤版本element-ui css import NProgress from 'nprogress'; // Progress 进度条 import 'nprogress/nprogress.css';// Progress 进度条 样式 import 'normalize.css/normalize.css';// normalize.css 样式格式化 -import 'styles/index.scss'; // 全局自定义的css样式 import 'components/Icon-svg/index'; // 封装的svg组件 import 'assets/iconfont/iconfont'; // iconfont 具体图标见https://github.com/PanJiaChen/vue-element-admin/wiki import * as filters from './filters'; // 全局vue filter diff --git a/src/styles/index.scss b/src/styles/index.scss index e566c382..5bf93a89 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,6 +1,6 @@ @import './btn.scss'; @import './element-ui.scss'; -@import "./mixin.scss"; +@import './mixin.scss'; body { -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; @@ -108,7 +108,6 @@ code { margin-top: 30px; } - .editor-container .CodeMirror { height: 100%!important; } From b15caf637fdc9b8e9d980ae3018c7fe0027687b7 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 30 Jun 2017 13:40:18 +0800 Subject: [PATCH 2/2] fix tabel demo bug --- .../example/table/dynamictable/fixedThead.vue | 22 ++++++++----------- .../table/dynamictable/unfixedThead.vue | 22 ++++++++----------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/views/example/table/dynamictable/fixedThead.vue b/src/views/example/table/dynamictable/fixedThead.vue index 9c3ea5a7..aa7a4bc6 100644 --- a/src/views/example/table/dynamictable/fixedThead.vue +++ b/src/views/example/table/dynamictable/fixedThead.vue @@ -13,7 +13,7 @@ @@ -28,20 +28,16 @@ return { tableData: [ { - name: 'fruit1', - list: [ - { name: 'apple1', value: 10 }, - { name: 'banana1', value: 20 }, - { name: 'orange1', value: 20 } - ] + name: 'fruit-1', + apple: 'apple-10', + banana: 'banana-10', + orange: 'orange-10' }, { - name: 'fruit2', - list: [ - { name: 'apple2', value: 12 }, - { name: 'banana2', value: 22 }, - { name: 'orange2', value: 20 } - ] + name: 'fruit-2', + apple: 'apple-20', + banana: 'banana-20', + orange: 'orange-20' } ], key: 1, // table key diff --git a/src/views/example/table/dynamictable/unfixedThead.vue b/src/views/example/table/dynamictable/unfixedThead.vue index 5aa4a88b..68fcd620 100644 --- a/src/views/example/table/dynamictable/unfixedThead.vue +++ b/src/views/example/table/dynamictable/unfixedThead.vue @@ -14,7 +14,7 @@ @@ -28,20 +28,16 @@ return { tableData: [ { - name: 'fruit1', - list: [ - { name: 'apple1', value: 10 }, - { name: 'banana1', value: 20 }, - { name: 'orange1', value: 20 } - ] + name: 'fruit-1', + apple: 'apple-10', + banana: 'banana-10', + orange: 'orange-10' }, { - name: 'fruit2', - list: [ - { name: 'apple2', value: 12 }, - { name: 'banana2', value: 22 }, - { name: 'orange2', value: 20 } - ] + name: 'fruit-2', + apple: 'apple-20', + banana: 'banana-20', + orange: 'orange-20' } ], formThead: ['apple', 'banana']