From 50983ca28e87ed6c0679eee608b6451f5c0813ad Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 28 Jul 2017 11:02:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9D=E8=B5=96=E6=9B=B4=E6=96=B0=20&&=20?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E8=B0=83=E6=95=B4=20(#60)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * upgrade dependencies * 更改所有 saladcss 写法 * fix: 升级依赖导致的样式错误 * fix: build vant css * use es module when pack && webpack scope hoisting * fix: vue module version * delete unused npm script * fix: build:vant script not work * fix: webpack config format * fix: build minify vant.js * fix: captain ui relative link --- .babelrc | 7 +- build/bin/build-entry.js | 30 +- build/genExamples.js | 6 +- build/strip-tags.js | 34 - build/utils/postcss_pipe.js | 29 - build/webpack.build.js | 19 +- build/webpack.build.min.js | 20 - build/webpack.components.js | 7 +- build/webpack.config.dev.js | 134 +- docs/examples-docs/actionsheet.md | 20 +- docs/examples-docs/badge.md | 16 +- docs/examples-docs/button.md | 28 +- docs/examples-docs/checkbox.md | 12 +- docs/examples-docs/dialog.md | 8 +- docs/examples-docs/field.md | 8 +- docs/examples-docs/icon.md | 26 +- docs/examples-docs/image-preview.md | 8 +- docs/examples-docs/layout.md | 14 +- docs/examples-docs/lazyload.md | 22 +- docs/examples-docs/loading.md | 28 +- docs/examples-docs/panel.md | 38 +- docs/examples-docs/popup.md | 56 +- docs/examples-docs/progress.md | 14 +- docs/examples-docs/quantity.md | 14 +- docs/examples-docs/quickstart.md | 2 +- docs/examples-docs/radio.md | 12 +- docs/examples-docs/steps.md | 14 +- docs/examples-docs/swipe.md | 12 +- docs/examples-docs/switch.md | 28 +- docs/examples-docs/tab.md | 38 +- docs/examples-docs/toast.md | 8 +- docs/examples-docs/waterfall.md | 42 +- docs/src/components/mobile-nav.vue | 125 +- package.json | 118 +- packages/toast/src/toast.js | 4 +- packages/toast/src/toast.vue | 16 +- packages/vant-css/gulpfile.js | 3 +- packages/vant-css/package.json | 11 +- packages/vant-css/src/actionsheet.css | 128 +- packages/vant-css/src/badge.css | 120 +- packages/vant-css/src/button.css | 274 ++- packages/vant-css/src/cell-swipe.css | 43 +- packages/vant-css/src/cell.css | 140 +- packages/vant-css/src/checkbox.css | 80 +- packages/vant-css/src/col.css | 53 +- packages/vant-css/src/dialog.css | 149 +- packages/vant-css/src/field.css | 175 +- packages/vant-css/src/image_preview.css | 56 +- packages/vant-css/src/loading.css | 103 +- packages/vant-css/src/panel.css | 76 +- packages/vant-css/src/picker.css | 121 +- packages/vant-css/src/popup.css | 14 +- packages/vant-css/src/progress.css | 53 +- packages/vant-css/src/quantity.css | 160 +- packages/vant-css/src/radio.css | 76 +- packages/vant-css/src/search.css | 126 +- packages/vant-css/src/steps.css | 374 ++-- packages/vant-css/src/swipe.css | 64 +- packages/vant-css/src/switch.css | 108 +- packages/vant-css/src/tab.css | 166 +- packages/vant-css/src/tag.css | 100 +- packages/vant-css/src/toast.css | 86 +- packages/vant-css/src/uploader.css | 36 +- packages/vant-css/yarn.lock | 396 ++-- postcss.config.js | 11 + src/index.js | 120 +- test/unit/get-webpack-conf.js | 5 +- yarn.lock | 2383 +++++++++++++++-------- 68 files changed, 3678 insertions(+), 3149 deletions(-) delete mode 100644 build/strip-tags.js delete mode 100644 build/utils/postcss_pipe.js delete mode 100644 build/webpack.build.min.js create mode 100644 postcss.config.js diff --git a/.babelrc b/.babelrc index b061392b0..c72eeb3a2 100644 --- a/.babelrc +++ b/.babelrc @@ -1,9 +1,12 @@ { "presets": [ - "es2015" + [ + "es2015", + { "modules": false } + ] ], "plugins": [ "transform-runtime", "transform-vue-jsx" ] -} +} \ No newline at end of file diff --git a/build/bin/build-entry.js b/build/bin/build-entry.js index b70e79e86..db939e763 100644 --- a/build/bin/build-entry.js +++ b/build/bin/build-entry.js @@ -3,18 +3,23 @@ var fs = require('fs'); var render = require('json-templater/string'); var uppercamelcase = require('uppercamelcase'); var path = require('path'); -var chalk = require('chalk'); var OUTPUT_PATH = path.join(__dirname, '../../src/index.js'); var IMPORT_TEMPLATE = 'import {{name}} from \'../packages/{{package}}/index.js\';'; -var ISNTALL_COMPONENT_TEMPLATE = ' Vue.component({{name}}.name, {{name}});'; +var ISNTALL_COMPONENT_TEMPLATE = ' {{name}}'; var MAIN_TEMPLATE = `{{include}} +const version = '{{version}}'; +const components = [ +{{components}} +]; + const install = function(Vue) { - /* istanbul ignore if */ if (install.installed) return; -{{install}} + components.forEach(component => { + Vue.component(component.name, component); + }); }; /* istanbul ignore if */ @@ -22,9 +27,14 @@ if (typeof window !== 'undefined' && window.Vue) { install(window.Vue); } -module.exports = { +export { install, - version: '{{version}}', + version, +{{list}} +}; +export default { + install, + version, {{list}} }; `; @@ -66,11 +76,11 @@ ComponentNames.forEach(name => { var template = render(MAIN_TEMPLATE, { include: includeComponentTemplate.join('\n'), - install: installTemplate.join('\n'), - version: process.env.VERSION || require('../../package.json').version, - list: listTemplate.join(',\n') + list: listTemplate.join(',\n'), + components: installTemplate.join(',\n') || ' ', + version: process.env.VERSION || require('../../package.json').version }); fs.writeFileSync(OUTPUT_PATH, template); -console.log(chalk.green('[build entry] DONE:' + OUTPUT_PATH)); +console.log('[build entry] DONE:' + OUTPUT_PATH); diff --git a/build/genExamples.js b/build/genExamples.js index b9ecdb6fb..c668082f9 100644 --- a/build/genExamples.js +++ b/build/genExamples.js @@ -11,8 +11,6 @@ function extract(watch = false) { }); } -extract(); - -module.exports = function watch() { - extract(true); +module.exports = function watch(isProduction) { + extract(!isProduction); }; diff --git a/build/strip-tags.js b/build/strip-tags.js deleted file mode 100644 index bbb719c19..000000000 --- a/build/strip-tags.js +++ /dev/null @@ -1,34 +0,0 @@ -/*! - * strip-tags - * - * Copyright (c) 2015 Jon Schlinkert, contributors. - * Licensed under the MIT license. - */ - -'use strict'; - -var cheerio = require('cheerio'); - -exports.strip = function(str, tags) { - var $ = cheerio.load(str, {decodeEntities: false}); - - if (!tags || tags.length === 0) { - return str; - } - - tags = !Array.isArray(tags) ? [tags] : tags; - var len = tags.length; - - while (len--) { - $(tags[len]).remove(); - } - - return $.html(); -}; - -exports.fetch = function(str, tag) { - var $ = cheerio.load(str, {decodeEntities: false}); - if (!tag) return str; - - return $(tag).html(); -}; diff --git a/build/utils/postcss_pipe.js b/build/utils/postcss_pipe.js deleted file mode 100644 index f1bdbd8d1..000000000 --- a/build/utils/postcss_pipe.js +++ /dev/null @@ -1,29 +0,0 @@ -var config = { - 'bem': { - 'shortcuts': {'component': 'b', 'modifier': 'm', 'descendent': 'e'}, - 'separators': {'descendent': '__', 'modifier': '--'} - } -}; - -// https://github.com/trysound/postcss-easy-import -var partialImport = require('postcss-easy-import')(); - -// 这不是bem,虽然名字叫bem,其实它是suit -// https://github.com/saladcss/saladcss-bem -var bem = require('saladcss-bem')(config.bem); - -// https://github.com/jonathantneal/precss -var precss = require('precss')(); - -// https://github.com/postcss/autoprefixer -var autoprefixer = require('autoprefixer')(); - -module.exports = function (webpack) { - // 顺序很重要 - return [ - partialImport, - bem, - precss, - autoprefixer - ]; -}; diff --git a/build/webpack.build.js b/build/webpack.build.js index 6b3a3ad0d..0ce2bb610 100644 --- a/build/webpack.build.js +++ b/build/webpack.build.js @@ -1,13 +1,13 @@ -var webpack = require('webpack'); -var getPostcssPlugin = require('./utils/postcss_pipe'); -var config = require('./webpack.config.dev.js'); +const webpack = require('webpack'); +const config = require('./webpack.config.dev.js'); +const isMinify = process.argv.indexOf('-p') !== -1; config.entry = { 'vant': './src/index.js' }; config.output = { - filename: './lib/[name].js', + filename: isMinify ? './lib/[name].min.js' : './lib/[name].js', library: 'vant', libraryTarget: 'umd', umdNamedDefine: true @@ -30,18 +30,13 @@ config.plugins = [ minimize: true, debug: false, options: { - postcss: getPostcssPlugin, - babel: { - presets: ['es2015'], - plugins: ['transform-runtime', 'transform-vue-jsx'] - }, vue: { autoprefixer: false, - preserveWhitespace: false, - postcss: getPostcssPlugin + preserveWhitespace: false } } - }) + }), + new webpack.optimize.ModuleConcatenationPlugin() ]; delete config.devtool; diff --git a/build/webpack.build.min.js b/build/webpack.build.min.js deleted file mode 100644 index d9cdcfaa7..000000000 --- a/build/webpack.build.min.js +++ /dev/null @@ -1,20 +0,0 @@ -var webpack = require('webpack'); -var config = require('./webpack.build.js'); - -config.entry = { - 'index': './src/index.js' -}; - -config.plugins = config.plugins.concat([ - new webpack.optimize.UglifyJsPlugin({ - compress: { - warnings: false - }, - output: { - comments: false - }, - sourceMap: false - }) -]); - -module.exports = config; diff --git a/build/webpack.components.js b/build/webpack.components.js index b0b2b91e2..f58de943f 100644 --- a/build/webpack.components.js +++ b/build/webpack.components.js @@ -1,6 +1,7 @@ -var path = require('path'); -var Components = require('../components.json'); -var config = require('./webpack.build.js'); +const path = require('path'); +const Components = require('../components.json'); +const config = require('./webpack.build.js'); +const webpack = require('webpack'); delete config.devtool; diff --git a/build/webpack.config.dev.js b/build/webpack.config.dev.js index 4294b858c..9cad7ac96 100644 --- a/build/webpack.config.dev.js +++ b/build/webpack.config.dev.js @@ -1,44 +1,20 @@ -var webpack = require('webpack'); -var path = require('path'); -var slugify = require('transliteration').slugify; -var striptags = require('./strip-tags'); -var ExtractTextPlugin = require('extract-text-webpack-plugin'); -var getPostcssPlugin = require('./utils/postcss_pipe'); -var ProgressBarPlugin = require('progress-bar-webpack-plugin'); -var HtmlWebpackPlugin = require('html-webpack-plugin'); -var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); -var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') +const webpack = require('webpack'); +const path = require('path'); +const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const ProgressBarPlugin = require('progress-bar-webpack-plugin'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); +const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin'); const isProduction = process.env.NODE_ENV === 'production'; -const watchExample = require('./genExamples'); - -if (!isProduction) { - watchExample(); -} - -var StyleExtractPlugin; -if (process.env.NODE_ENV === 'production') { - StyleExtractPlugin = new ExtractTextPlugin('[name].[hash:8].css'); -} else { - StyleExtractPlugin = new ExtractTextPlugin('[name].css'); -} - -function convert(str) { - str = str.replace(/(&#x)(\w{4});/gi, function($0) { - return String.fromCharCode(parseInt(encodeURIComponent($0).replace(/(%26%23x)(\w{4})(%3B)/g, '$2'), 16)); - }); - return str; -} - -function wrap(render) { - return function() { - return render.apply(this, arguments) - .replace(/\
`; + render: function(tokens, idx) { + return tokens[idx].nesting === 1 + ? `
` + :`
\n`; } - return `
\n`; } - }] + ] ], preprocess: function(MarkdownIt, source) { - MarkdownIt.renderer.rules.table_open = function() { - return ''; - }; + MarkdownIt.renderer.rules.table_open = () => '
'; return source; } } @@ -160,7 +133,10 @@ module.exports = { }), new webpack.HotModuleReplacementPlugin(), new OptimizeCssAssetsPlugin(), - StyleExtractPlugin, + new ExtractTextPlugin({ + filename: isProduction ? '[name].[hash:8].css' : '[name].css', + allChunks: true + }), new FriendlyErrorsPlugin() ] }; diff --git a/docs/examples-docs/actionsheet.md b/docs/examples-docs/actionsheet.md index d560ccf69..92a645069 100644 --- a/docs/examples-docs/actionsheet.md +++ b/docs/examples-docs/actionsheet.md @@ -1,17 +1,15 @@ diff --git a/docs/examples-docs/badge.md b/docs/examples-docs/badge.md index 509532fa9..c325671a3 100644 --- a/docs/examples-docs/badge.md +++ b/docs/examples-docs/badge.md @@ -1,14 +1,12 @@ diff --git a/docs/examples-docs/button.md b/docs/examples-docs/button.md index c1504e9bf..86399691d 100644 --- a/docs/examples-docs/button.md +++ b/docs/examples-docs/button.md @@ -1,20 +1,18 @@ diff --git a/docs/examples-docs/field.md b/docs/examples-docs/field.md index 5dc74c679..a48bb9618 100644 --- a/docs/examples-docs/field.md +++ b/docs/examples-docs/field.md @@ -1,9 +1,7 @@ diff --git a/docs/examples-docs/icon.md b/docs/examples-docs/icon.md index 33b302122..47bdde690 100644 --- a/docs/examples-docs/icon.md +++ b/docs/examples-docs/icon.md @@ -1,20 +1,18 @@ diff --git a/docs/examples-docs/image-preview.md b/docs/examples-docs/image-preview.md index 2e214e59c..55bb07f72 100644 --- a/docs/examples-docs/image-preview.md +++ b/docs/examples-docs/image-preview.md @@ -1,9 +1,7 @@ diff --git a/docs/examples-docs/layout.md b/docs/examples-docs/layout.md index b8364ff62..179abbe79 100644 --- a/docs/examples-docs/layout.md +++ b/docs/examples-docs/layout.md @@ -1,12 +1,10 @@ diff --git a/docs/examples-docs/loading.md b/docs/examples-docs/loading.md index 0f0461aa8..e62e21f8f 100644 --- a/docs/examples-docs/loading.md +++ b/docs/examples-docs/loading.md @@ -1,21 +1,19 @@ diff --git a/docs/examples-docs/panel.md b/docs/examples-docs/panel.md index 082b9fbfb..5d2f870a5 100644 --- a/docs/examples-docs/panel.md +++ b/docs/examples-docs/panel.md @@ -1,30 +1,28 @@ diff --git a/docs/examples-docs/popup.md b/docs/examples-docs/popup.md index 171bcd4ee..dd582573b 100644 --- a/docs/examples-docs/popup.md +++ b/docs/examples-docs/popup.md @@ -1,37 +1,35 @@ diff --git a/docs/examples-docs/progress.md b/docs/examples-docs/progress.md index 795ba5235..f2287f31d 100644 --- a/docs/examples-docs/progress.md +++ b/docs/examples-docs/progress.md @@ -1,12 +1,10 @@ diff --git a/docs/examples-docs/quantity.md b/docs/examples-docs/quantity.md index f1933d182..0f0191a3a 100644 --- a/docs/examples-docs/quantity.md +++ b/docs/examples-docs/quantity.md @@ -1,13 +1,11 @@ diff --git a/docs/examples-docs/quickstart.md b/docs/examples-docs/quickstart.md index c0b202cc7..b69b15462 100644 --- a/docs/examples-docs/quickstart.md +++ b/docs/examples-docs/quickstart.md @@ -2,7 +2,7 @@ 一套基于`Vue.js 2.0`的 Mobile 组件库 -[查看业务组件库 Captain-UI](https://www.youzanyun.com/zanui/captain/component/quickstart) +[查看业务组件库 Captain-UI](/zanui/captain/component/quickstart) ### 安装 diff --git a/docs/examples-docs/radio.md b/docs/examples-docs/radio.md index 277bb9e57..f42b7c977 100644 --- a/docs/examples-docs/radio.md +++ b/docs/examples-docs/radio.md @@ -1,12 +1,10 @@ diff --git a/docs/examples-docs/swipe.md b/docs/examples-docs/swipe.md index f7aff3bb1..b584c0feb 100644 --- a/docs/examples-docs/swipe.md +++ b/docs/examples-docs/swipe.md @@ -1,12 +1,10 @@ diff --git a/docs/src/components/mobile-nav.vue b/docs/src/components/mobile-nav.vue index bb76f9136..c9b6e7de6 100644 --- a/docs/src/components/mobile-nav.vue +++ b/docs/src/components/mobile-nav.vue @@ -62,82 +62,79 @@ export default { }; - diff --git a/package.json b/package.json index a984d1d87..ad28a87c7 100644 --- a/package.json +++ b/package.json @@ -12,16 +12,15 @@ ], "scripts": { "bootstrap": "yarn || npm i", - "dev": "npm run build:file && webpack-dev-server --inline --hot --config build/webpack.config.dev.js --content-base ./", + "dev": "npm run build:file && webpack-dev-server --inline --config build/webpack.config.dev.js --content-base ./", "build:file": "node build/bin/build-entry.js", "build:utils": "cross-env BABEL_ENV=utils babel src --out-dir lib --ignore src/index.js", - "build:vant-css": "gulp build --gulpfile packages/vant-css/gulpfile.js && cp-cli packages/vant-css/lib lib/vant-css", - "build:components": "webpack --progress --hide-modules --config build/webpack.components.js", - "build:vant": "webpack --progress --hide-modules --config build/webpack.build.js && webpack --progress --hide-modules --config build/webpack.build.min.js", - "build:example": "node build/genExamples.js", + "build:vant-css": "gulp build --gulpfile packages/vant-css/gulpfile.js && cp -R packages/vant-css/lib/ lib/vant-css", + "build:components": "cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.components.js", + "build:vant": "cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.build.js && cross-env NODE_ENV=production webpack -p --progress --hide-modules --config build/webpack.build.js", "deploy": "npm run deploy:docs && npm run deploy:cdn && gh-pages -d docs/dist --remote youzan && rimraf docs/dist", "deploy:cdn": "superman cdn /zanui/vue docs/dist/*.js docs/dist/*.css", - "deploy:docs": "rimraf docs/dist && npm run build:example && cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.config.prod.js", + "deploy:docs": "rimraf docs/dist && cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.config.prod.js", "dist": "npm run clean && npm run build:file && npm run lint && npm run build:vant && npm run build:components && npm run build:utils && npm run build:vant-css", "clean": "rimraf lib && rimraf packages/*/lib", "lint": "felint lint src/**/*.js packages/**/*.{js,vue} build/**/*.js", @@ -43,98 +42,79 @@ "license": "ISC", "dependencies": { "raf.js": "0.0.4", - "vue-lazyload": "^1.0.3" + "vue-lazyload": "^1.0.6" }, "peerDependencies": { "vue": "2.3.4" }, "devDependencies": { - "autoprefixer": "^6.7.5", - "avoriaz": "^2.0.0", + "autoprefixer": "^7.1.2", + "avoriaz": "2.0.0", "babel-cli": "^6.14.0", - "babel-core": "^6.17.0", - "babel-eslint": "^6.1.2", - "babel-helper-vue-jsx-merge-props": "^2.0.2", - "babel-loader": "^6.2.5", - "babel-plugin-module-resolver": "^2.2.0", + "babel-core": "^6.25.0", + "babel-loader": "^7.1.1", + "babel-plugin-module-resolver": "^2.7.1", "babel-plugin-syntax-jsx": "^6.18.0", "babel-plugin-transform-runtime": "^6.15.0", - "babel-plugin-transform-vue-jsx": "^3.3.0", + "babel-plugin-transform-vue-jsx": "^3.5.0", "babel-polyfill": "^6.23.0", "babel-preset-es2015": "^6.16.0", - "babel-runtime": "^6.11.0", - "chai": "^3.5.0", - "chalk": "^1.1.3", + "babel-runtime": "^6.25.0", + "chai": "^4.1.0", "cheerio": "^0.22.0", - "codecov": "^2.1.0", - "copy-webpack-plugin": "^4.0.1", - "cp-cli": "^1.0.2", - "cross-env": "^3.1.3", - "css-loader": "^0.24.0", - "decamelize": "^1.2.0", - "eslint-loader": "^1.7.1", - "eslint-plugin-vue": "^2.0.1", - "extract-text-webpack-plugin": "^2.0.0-beta.5", + "codecov": "^2.2.0", + "cross-env": "^5.0.1", + "css-loader": "^0.28.4", + "eslint-plugin-vue": "^2.1.0", + "extract-text-webpack-plugin": "2.1.2", "felint": "^0.5.0-alpha.3", - "file-loader": "^0.9.0", "file-save": "^0.2.0", "friendly-errors-webpack-plugin": "^1.6.1", - "gh-pages": "^0.12.0", + "gh-pages": "^1.0.0", "gulp": "^3.9.1", "gulp-util": "^3.0.8", - "highlight.js": "^9.8.0", - "html-loader": "^0.4.3", - "html-webpack-plugin": "^2.22.0", - "inject-loader": "^3.0.0-beta2", + "highlight.js": "^9.12.0", + "html-webpack-plugin": "^2.29.0", "isparta-loader": "^2.0.0", - "json-loader": "^0.5.4", "json-templater": "^1.0.4", - "karma": "^1.5.0", - "karma-chrome-launcher": "^2.0.0", + "karma": "^1.7.0", + "karma-chrome-launcher": "^2.2.0", "karma-coverage": "^1.1.1", "karma-mocha": "^1.3.0", "karma-phantomjs-launcher": "^1.0.4", "karma-sinon-chai": "^1.2.4", "karma-sourcemap-loader": "^0.3.7", - "karma-spec-reporter": "0.0.30", - "karma-webpack": "^2.0.2", - "lerna": "2.0.0-beta.31", - "lolex": "^1.5.1", - "markdown-it": "^6.1.1", - "markdown-it-anchor": "^2.5.0", + "karma-spec-reporter": "^0.0.31", + "karma-webpack": "^2.0.4", + "lerna": "^2.0.0", + "markdown-it": "^8.3.1", "markdown-it-container": "^2.0.0", - "mocha": "^3.2.0", - "optimize-css-assets-webpack-plugin": "^1.3.0", - "postcss": "^5.1.2", - "postcss-easy-import": "^2.0.0", - "postcss-loader": "^1.3.3", - "precss": "^1.4.0", - "prismjs": "^1.5.1", - "progress-bar-webpack-plugin": "^1.9.3", + "mocha": "^3.4.2", + "optimize-css-assets-webpack-plugin": "^3.0.0", + "postcss": "^6.0.8", + "postcss-easy-import": "^2.1.0", + "postcss-loader": "^2.0.6", + "precss": "^2.0.0", + "progress-bar-webpack-plugin": "^1.10.0", "rimraf": "^2.5.4", - "run-sequence": "^1.2.2", - "saladcss-bem": "^0.0.1", - "sinon": "^1.17.7", - "sinon-chai": "^2.8.0", - "style-loader": "^0.13.1", - "theaterjs": "^3.0.0", - "transliteration": "^1.1.11", - "uppercamelcase": "^1.1.0", - "url-loader": "^0.5.7", - "vue": "2.3.4", + "run-sequence": "^2.1.0", + "sinon": "^2.4.1", + "sinon-chai": "^2.12.0", + "style-loader": "^0.18.2", + "uppercamelcase": "^3.0.0", + "url-loader": "^0.5.9", + "vue": "^2.4.2", "vue-hot-reload-api": "^2.1.0", "vue-html-loader": "^1.2.4", - "vue-loader": "^12.0.0", + "vue-loader": "^13.0.2", "vue-markdown-loader": "^1.0.0", - "vue-router": "^2.5.0", + "vue-router": "^2.7.0", "vue-style-loader": "^3.0.0", - "vue-template-compiler": "2.3.4", - "vue-template-es2015-compiler": "^1.4.2", - "webpack": "^2.2.1", - "webpack-dev-server": "^1.16.3", - "webpack-merge": "^2.0.0", - "webpack-node-externals": "^1.5.4", - "webpack-vendor-chunk-plugin": "^1.0.0", + "vue-template-compiler": "^2.4.2", + "vue-template-es2015-compiler": "^1.5.3", + "webpack": "^3.4.1", + "webpack-dev-server": "^2.6.1", + "webpack-merge": "^4.1.0", "zan-doc": "^0.1.0" } } diff --git a/packages/toast/src/toast.js b/packages/toast/src/toast.js index 3833f9894..727b6a315 100644 --- a/packages/toast/src/toast.js +++ b/packages/toast/src/toast.js @@ -1,7 +1,8 @@ import Vue from 'vue'; import merge from 'src/utils/merge'; +import ToastComponent from './toast.vue'; -const ToastConstructor = Vue.extend(require('./toast.vue')); +const ToastConstructor = Vue.extend(ToastComponent); let instance; const getInstance = () => { @@ -24,6 +25,7 @@ var Toast = (options = {}) => { const duration = options.duration || 3000; const instance = getInstance(); + instance.closed = false; clearTimeout(instance.timer); instance.type = options.type ? options.type : 'text'; diff --git a/packages/toast/src/toast.vue b/packages/toast/src/toast.vue index 3129dea0b..b288f510a 100644 --- a/packages/toast/src/toast.vue +++ b/packages/toast/src/toast.vue @@ -1,24 +1,18 @@