diff --git a/build/bin/build-entry.js b/build/bin/build-entry.js index 4f4122395..0ceccbc1c 100644 --- a/build/bin/build-entry.js +++ b/build/bin/build-entry.js @@ -9,7 +9,6 @@ function buildVantEntry() { const uninstallComponents = [ 'Lazyload', 'Waterfall', - 'Dialog', 'Toast', 'ImagePreview', 'Locale' diff --git a/docs/demos/common.js b/docs/demos/common.js index 0ad3d5a11..b2f7f208b 100644 --- a/docs/demos/common.js +++ b/docs/demos/common.js @@ -31,6 +31,8 @@ Vue.component('demo-section', DemoSection); Locale.add({ 'zh-CN': { + add: '增加', + decrease: '减少', red: '红色', orange: '橙色', yellow: '黄色', @@ -45,13 +47,19 @@ Locale.add({ search: '搜索', content: '内容', custom: '自定义', + username: '用户名', + password: '密码', loading: '加载状态', disabled: '禁用状态', uneditable: '不可编辑', basicUsage: '基础用法', - advancedUsage: '高级用法' + advancedUsage: '高级用法', + usernamePlaceholder: '请输入用户名', + passwordPlaceholder: '请输入密码' }, 'en-US': { + add: 'Add', + decrease: 'Decrease', red: 'Red', orange: 'Orange', yellow: 'Yellow', @@ -66,10 +74,14 @@ Locale.add({ search: 'Search', content: 'Content', custom: 'Custom', + username: 'Username', + password: 'Password', loading: 'Loading', disabled: 'Disabled', uneditable: 'Uneditable', basicUsage: 'Basic Usage', - advancedUsage: 'Advanced Usage' + advancedUsage: 'Advanced Usage', + usernamePlaceholder: 'Username', + passwordPlaceholder: 'Password' } }); diff --git a/docs/demos/index.js b/docs/demos/index.js index 7a6113cf3..a3c210b92 100644 --- a/docs/demos/index.js +++ b/docs/demos/index.js @@ -31,6 +31,7 @@ export default { 'cell-swipe': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/cell-swipe'), 'cell-swipe')), 'cell-swipe')), 'cell': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/cell'), 'cell')), 'cell')), 'checkbox': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/checkbox'), 'checkbox')), 'checkbox')), + 'circle': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/circle'), 'circle')), 'circle')), 'contact': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/contact'), 'contact')), 'contact')), 'coupon': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/coupon'), 'coupon')), 'coupon')), 'datetime-picker': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/datetime-picker'), 'datetime-picker')), 'datetime-picker')), diff --git a/docs/demos/mock/sku.js b/docs/demos/mock/sku.js index 828a00312..5d5732349 100644 --- a/docs/demos/mock/sku.js +++ b/docs/demos/mock/sku.js @@ -366,7 +366,7 @@ export default { extend: null, kdt_id: 55, discount_price: 0, - stock_num: 6, + stock_num: 4, stock_mode: 0, is_sell: null, combin_sku: false, @@ -506,7 +506,7 @@ export default { alias: '2oml0r0n5vytj', quota: 15, is_virtual: '0', - quota_used: 0, + quota_used: 1, goods_info: { title: 'Goods Name', picture: 'https://img.yzcdn.cn/upload_files/2017/03/16/Fs_OMbSFPa183sBwvG_94llUYiLa.jpeg?imageView2/2/w/100/h/100/q/75/format/jpg', diff --git a/docs/demos/views/button.vue b/docs/demos/views/button.vue index cad8cdfc4..7d3b5a291 100644 --- a/docs/demos/views/button.vue +++ b/docs/demos/views/button.vue @@ -92,6 +92,10 @@ export default { &--normal { margin-right: 10px; } + + .van-loading { + margin: 0 18px; + } } .van-doc-demo-block { diff --git a/docs/demos/views/cell-swipe.vue b/docs/demos/views/cell-swipe.vue index 05c21e685..992cffe1a 100644 --- a/docs/demos/views/cell-swipe.vue +++ b/docs/demos/views/cell-swipe.vue @@ -1,7 +1,7 @@ @@ -26,6 +46,14 @@ export default { } }, + data() { + return { + show: false, + username: '', + password: '' + }; + }, + methods: { onClickAlert() { Dialog.alert({ @@ -52,7 +80,7 @@ export default { diff --git a/docs/demos/views/picker.vue b/docs/demos/views/picker.vue index 9e752f784..d06ee9a5f 100644 --- a/docs/demos/views/picker.vue +++ b/docs/demos/views/picker.vue @@ -21,6 +21,10 @@ + + + + diff --git a/docs/demos/views/pull-refresh.vue b/docs/demos/views/pull-refresh.vue index 0b3084ead..f63c6c214 100644 --- a/docs/demos/views/pull-refresh.vue +++ b/docs/demos/views/pull-refresh.vue @@ -1,21 +1,23 @@ + diff --git a/docs/src/doc.config.js b/docs/src/doc.config.js index c14fd4b24..77189b041 100644 --- a/docs/src/doc.config.js +++ b/docs/src/doc.config.js @@ -4,7 +4,7 @@ module.exports = { header: { logo: { image: 'https://img.yzcdn.cn/public_files/2017/12/18/fd78cf6bb5d12e2a119d0576bedfd230.png', - title: 'Zan UI', + title: 'Vant', href: 'http://www.youzanyun.com/zanui' }, nav: { @@ -80,6 +80,10 @@ module.exports = { path: '/cell', title: 'Cell - 单元格' }, + { + path: '/circle', + title: 'Circle - 环形进度条' + }, { path: '/icon', title: 'Icon - 图标' @@ -282,7 +286,7 @@ module.exports = { header: { logo: { image: 'https://img.yzcdn.cn/public_files/2017/12/18/fd78cf6bb5d12e2a119d0576bedfd230.png', - title: 'Zan UI', + title: 'Vant', href: 'http://www.youzanyun.com/zanui' }, nav: { @@ -358,6 +362,10 @@ module.exports = { path: '/cell', title: 'Cell' }, + { + path: '/circle', + title: 'Circle' + }, { path: '/icon', title: 'Icon' diff --git a/docs/src/examples.js b/docs/src/examples.js index 1fe6abe65..f3b3d17eb 100644 --- a/docs/src/examples.js +++ b/docs/src/examples.js @@ -9,12 +9,13 @@ import 'packages/vant-css/src/icon-local.css'; import 'vant-doc/src/helper/touch-simulator'; import './components/nprogress.css'; -Vue.use(Vant); -Vue.use(VantDoc); -Vue.use(Lazyload, { - lazyComponent: true -}); -Vue.use(VueRouter); +Vue + .use(Vant) + .use(VantDoc) + .use(VueRouter) + .use(Lazyload, { + lazyComponent: true + }); const routesConfig = routes(true); const router = new VueRouter({ @@ -23,6 +24,13 @@ const router = new VueRouter({ routes: routesConfig }); +router.afterEach(() => { + if (router.currentRoute.name) { + window.scrollTo(0, 0); + } + Vue.nextTick(() => window.syncPath()); +}); + window.vueRouter = router; new Vue({ // eslint-disable-line diff --git a/docs/src/index.js b/docs/src/index.js index 2fc6e3e1c..197afa9eb 100644 --- a/docs/src/index.js +++ b/docs/src/index.js @@ -6,8 +6,7 @@ import VantDoc from 'vant-doc'; import isMobile from './utils/is-mobile'; import './components/nprogress.css'; -Vue.use(VueRouter); -Vue.use(VantDoc); +Vue.use(VueRouter).use(VantDoc); const routesConfig = routes(); diff --git a/docs/src/index.tpl b/docs/src/index.tpl index 25be4e5ac..d8dad08f8 100644 --- a/docs/src/index.tpl +++ b/docs/src/index.tpl @@ -5,6 +5,7 @@ Vant - 有赞移动端 Vue 组件库 + diff --git a/docs/src/utils/iframe-router.js b/docs/src/utils/iframe-router.js index 458045e2e..5d45298a6 100644 --- a/docs/src/utils/iframe-router.js +++ b/docs/src/utils/iframe-router.js @@ -10,19 +10,21 @@ window.syncPath = function(dir) { const router = window.vueRouter; const isInIframe = window !== window.top; const currentDir = router.history.current.path; - const iframe = document.querySelector('iframe'); + const pathParts = currentDir.split('/'); + let lang = pathParts[0]; + if (currentDir[0] === '/') { + lang = pathParts[1]; + } - if (!isInIframe && !isMobile && iframe) { - const pathParts = currentDir.split('/'); - let lang = pathParts[0]; - if (currentDir[0] === '/') { - lang = pathParts[1]; + if (!isInIframe && !isMobile) { + const iframe = document.querySelector('iframe'); + if (iframe) { + iframeReady(iframe, () => { + iframe.contentWindow.changePath(lang, currentDir); + }); } - setLang(lang); - - iframeReady(iframe, () => { - iframe.contentWindow.changePath(lang, currentDir); - }); + } else if (isInIframe) { + window.top.changePath(lang, currentDir); } }; diff --git a/docs/src/utils/lang.js b/docs/src/utils/lang.js index 871808154..9eaf41d9f 100644 --- a/docs/src/utils/lang.js +++ b/docs/src/utils/lang.js @@ -12,6 +12,7 @@ const langMap = { messages: zhCN } }; +let currentLang = ''; setLang(getDefaultLang()); @@ -30,6 +31,11 @@ function getDefaultLang() { } export function setLang(lang) { + if (currentLang === lang) { + return; + } + + currentLang = lang; if (window.localStorage) { localStorage.setItem('VANT_LANGUAGE', lang); } diff --git a/package-lock.json b/package-lock.json index cba6758a1..089458e9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "0.12.4", + "version": "0.12.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2f431a5b5..4decfb7b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "0.12.4", + "version": "0.12.8", "description": "A Vue.js 2.0 Mobile UI at YouZan", "main": "lib/vant.js", "style": "lib/vant-css/index.css", @@ -50,7 +50,7 @@ "vue": ">= 2.5.0" }, "devDependencies": { - "autoprefixer": "^7.2.4", + "autoprefixer": "^7.2.5", "avoriaz": "2.0.0", "babel-cli": "^6.26.0", "babel-core": "^6.26.0", @@ -63,10 +63,10 @@ "chai": "^4.1.2", "codecov": "^3.0.0", "cross-env": "^5.1.3", - "css-loader": "^0.28.8", - "dependency-tree": "^5.12.0", - "eslint": "^4.15.0", - "eslint-plugin-vue": "^4.1.0", + "css-loader": "^0.28.9", + "dependency-tree": "^6.0.0", + "eslint": "^4.17.0", + "eslint-plugin-vue": "^4.2.2", "extract-text-webpack-plugin": "3.0.2", "fast-vue-md-loader": "^1.0.3", "friendly-errors-webpack-plugin": "^1.6.1", @@ -82,30 +82,30 @@ "karma-spec-reporter": "^0.0.32", "karma-webpack": "^2.0.9", "mocha": "^4.0.1", - "postcss": "^6.0.16", + "postcss": "^6.0.17", "postcss-calc": "^6.0.0", "postcss-easy-import": "^3.0.0", "postcss-loader": "^2.0.10", "precss": "2.0.0", "progress-bar-webpack-plugin": "^1.10.0", "rimraf": "^2.5.4", - "shelljs": "^0.7.8", + "shelljs": "^0.8.1", "sinon": "^2.4.1", "sinon-chai": "^2.12.0", - "style-loader": "^0.19.1", + "style-loader": "^0.20.1", "uppercamelcase": "^3.0.0", "url-loader": "^0.6.2", - "vant-doc": "1.0.1", + "vant-doc": "1.0.3", "vue": "^2.5.13", - "vue-loader": "^13.6.2", + "vue-loader": "^14.1.1", "vue-router": "^3.0.1", - "vue-sfc-compiler": "^0.0.7", - "vue-style-loader": "^3.0.0", + "vue-sfc-compiler": "^0.0.8", + "vue-style-loader": "^3.1.2", "vue-template-compiler": "^2.5.13", "vue-template-es2015-compiler": "^1.6.0", "webpack": "^3.10.0", - "webpack-bundle-analyzer": "^2.9.1", - "webpack-dev-server": "2.9.7", + "webpack-bundle-analyzer": "^2.10.0", + "webpack-dev-server": "2.11.1", "webpack-merge": "^4.1.1" } } diff --git a/packages/actionsheet/index.vue b/packages/actionsheet/index.vue index ec1333ffa..f04920049 100644 --- a/packages/actionsheet/index.vue +++ b/packages/actionsheet/index.vue @@ -17,7 +17,7 @@ {{ item.name }} {{ item.subname }} - +
+ ({ - code, - name: list[code] - })); + result = Object.keys(list).map(code => ({ + code, + name: list[code] + })); - if (type !== 'province' && code) { - result = result.filter(item => item.code.indexOf(code) === 0); + if (type !== 'province' && code) { + result = result.filter(item => item.code.indexOf(code) === 0); + } } result.unshift({ diff --git a/packages/button/index.vue b/packages/button/index.vue index 7ba592405..8e9df67d0 100644 --- a/packages/button/index.vue +++ b/packages/button/index.vue @@ -16,14 +16,9 @@ ]" @click="onClick" > - + - + {{ text }} @@ -35,6 +30,7 @@ export default create({ name: 'van-button', props: { + text: String, block: Boolean, loading: Boolean, disabled: Boolean, diff --git a/packages/circle/index.vue b/packages/circle/index.vue new file mode 100644 index 000000000..6bd78cc92 --- /dev/null +++ b/packages/circle/index.vue @@ -0,0 +1,126 @@ + + + diff --git a/packages/coupon-list/index.vue b/packages/coupon-list/index.vue index dfbfcd415..a2e40cc17 100644 --- a/packages/coupon-list/index.vue +++ b/packages/coupon-list/index.vue @@ -3,7 +3,7 @@ @@ -11,11 +11,11 @@ size="small" type="danger" class="van-coupon-list__exchange" - :disabled="exchangeButtonDisabled || !exchangeCode.length" + :text="exchangeButtonText || $t('exchange')" + :loading="exchangeButtonLoading" + :disabled="buttonDisabled" @click="onClickExchangeButton" - > - {{ exchangeButtonText || $t('exchange') }} - + />

{{ disabledListTitle || $t('disabled') }}

- {{ closeButtonText || $t('close') }} -
+ @click="$emit('change', -1)" + />
@@ -54,7 +53,6 @@ import Cell from '../cell'; import CellGroup from '../cell-group'; import CouponItem from './Item'; import Field from '../field'; -import Popup from '../popup'; import VanButton from '../button'; export default create({ @@ -65,15 +63,25 @@ export default create({ Cell, CellGroup, Field, - Popup, CouponItem }, + model: { + prop: 'code' + }, + props: { + code: String, closeButtonText: String, inputPlaceholder: String, disabledListTitle: String, exchangeButtonText: String, + exchangeButtonLoading: Boolean, + exchangeButtonDisabled: Boolean, + exchangeMinLength: { + type: Number, + default: 1 + }, chosenCoupon: { type: Number, default: -1 @@ -86,10 +94,6 @@ export default create({ type: Array, default: () => [] }, - exchangeButtonDisabled: { - type: Boolean, - default: false - }, displayedCouponIndex: { type: Number, default: -1 @@ -104,16 +108,34 @@ export default create({ } }, - watch: { - displayedCouponIndex(val) { - this.scrollToShowCoupon(val); + data() { + return { + currentCode: this.code || '' + }; + }, + + computed: { + buttonDisabled() { + return ( + !this.exchangeButtonLoading && + (this.exchangeButtonDisabled || + this.currentCode.length < this.exchangeMinLength) + ); } }, - data() { - return { - exchangeCode: '' - }; + watch: { + code(code) { + this.currentCode = code; + }, + + currentCode(code) { + this.$emit('input', code); + }, + + displayedCouponIndex(val) { + this.scrollToShowCoupon(val); + } }, mounted() { @@ -121,17 +143,16 @@ export default create({ }, methods: { - onClickNotUse() { - this.$emit('change', -1); - }, - onClickCoupon(index) { - this.$emit('change', index); - }, onClickExchangeButton() { - this.$emit('exchange', this.exchangeCode); - this.exchangeCode = ''; + this.$emit('exchange', this.currentCode); + + // auto clear currentCode when not use v-model + if (!this.code) { + this.currentCode = ''; + } }, - // 滚动到特定优惠券的位置 + + // scroll to show specific coupon scrollToShowCoupon(index) { if (index === -1) { return; diff --git a/packages/dialog/dialog.vue b/packages/dialog/dialog.vue index 4a8f0349b..166bf115e 100644 --- a/packages/dialog/dialog.vue +++ b/packages/dialog/dialog.vue @@ -50,14 +50,11 @@ export default create({ callback: Function, confirmButtonText: String, cancelButtonText: String, + showCancelButton: Boolean, showConfirmButton: { type: Boolean, default: true }, - showCancelButton: { - type: Boolean, - default: false - }, overlay: { type: Boolean, default: true diff --git a/packages/dialog/index.js b/packages/dialog/index.js index a52b5b916..37a46bc51 100644 --- a/packages/dialog/index.js +++ b/packages/dialog/index.js @@ -1,31 +1,10 @@ import Vue from 'vue'; -import DialogComponent from './dialog'; +import VanDialog from './dialog'; let instance; -const defaultOptions = { - value: true, - title: '', - message: '', - overlay: true, - lockOnScroll: true, - confirmButtonText: '', - cancelButtonText: '', - showConfirmButton: true, - showCancelButton: false, - closeOnClickOverlay: false, - callback: action => { - instance[action === 'confirm' ? 'resolve' : 'reject'](action); - } -}; - -let currentDefaultOptions = { - ...defaultOptions -}; - const initInstance = () => { - const DialogConstructor = Vue.extend(DialogComponent); - instance = new DialogConstructor({ + instance = new (Vue.extend(VanDialog))({ el: document.createElement('div') }); @@ -50,13 +29,29 @@ const Dialog = options => { }); }; +Dialog.defaultOptions = { + value: true, + title: '', + message: '', + overlay: true, + lockOnScroll: true, + confirmButtonText: '', + cancelButtonText: '', + showConfirmButton: true, + showCancelButton: false, + closeOnClickOverlay: false, + callback: action => { + instance[action === 'confirm' ? 'resolve' : 'reject'](action); + } +}; + Dialog.alert = options => Dialog({ - ...currentDefaultOptions, + ...Dialog.currentOptions, ...options }); Dialog.confirm = options => Dialog({ - ...currentDefaultOptions, + ...Dialog.currentOptions, showCancelButton: true, ...options }); @@ -65,22 +60,19 @@ Dialog.close = () => { instance.value = false; }; -Dialog.setDefaultOptions = (options = {}) => { - currentDefaultOptions = { - ...currentDefaultOptions, - ...options - }; +Dialog.setDefaultOptions = options => { + Object.assign(Dialog.currentOptions, options); }; Dialog.resetDefaultOptions = () => { - currentDefaultOptions = { - ...defaultOptions - }; + Dialog.currentOptions = { ...Dialog.defaultOptions }; +}; + +Dialog.install = () => { + Vue.component(VanDialog.name, VanDialog); }; Vue.prototype.$dialog = Dialog; +Dialog.resetDefaultOptions(); export default Dialog; -export { - DialogComponent as Dialog -}; diff --git a/packages/index.js b/packages/index.js index e0f2a340f..0d62c82e3 100644 --- a/packages/index.js +++ b/packages/index.js @@ -12,6 +12,7 @@ import CellGroup from './cell-group'; import CellSwipe from './cell-swipe'; import Checkbox from './checkbox'; import CheckboxGroup from './checkbox-group'; +import Circle from './circle'; import Col from './col'; import ContactCard from './contact-card'; import ContactEdit from './contact-edit'; @@ -62,7 +63,7 @@ import TreeSelect from './tree-select'; import Uploader from './uploader'; import Waterfall from './waterfall'; -const version = '0.12.4'; +const version = '0.12.8'; const components = [ Actionsheet, AddressEdit, @@ -77,6 +78,7 @@ const components = [ CellSwipe, Checkbox, CheckboxGroup, + Circle, Col, ContactCard, ContactEdit, @@ -84,6 +86,7 @@ const components = [ CouponCell, CouponList, DatetimePicker, + Dialog, Field, GoodsAction, GoodsActionBigBtn, @@ -148,6 +151,7 @@ export { CellSwipe, Checkbox, CheckboxGroup, + Circle, Col, ContactCard, ContactEdit, diff --git a/packages/loading/index.vue b/packages/loading/index.vue index f12c0c54c..897ac305e 100644 --- a/packages/loading/index.vue +++ b/packages/loading/index.vue @@ -1,7 +1,10 @@ @@ -11,16 +14,28 @@ import install from '../utils/install'; export default { install, + name: 'van-loading', + props: { + size: String, type: { type: String, - default: 'gradient-circle' + default: 'circular' }, color: { type: String, default: 'black' } + }, + + computed: { + style() { + return this.size ? { + width: this.size, + height: this.size + } : {}; + } } }; diff --git a/packages/locale/lang/en-US.js b/packages/locale/lang/en-US.js index 1523d74cd..d3fe13f4c 100644 --- a/packages/locale/lang/en-US.js +++ b/packages/locale/lang/en-US.js @@ -113,10 +113,12 @@ export default { }, vanSkuMessages: { fill: 'Please fill', + upload: 'Please upload', number: 'Please fill in the correct number format message', email: 'Please fill in the correct email message', idcard: 'Please fill in the correct ID number message', overlimit: 'not more than 200 words', + onePic: 'only one picture', placeholder: { 'id_no': 'Idcard Number', text: 'Text', @@ -127,6 +129,15 @@ export default { textarea: 'Text' } }, + vanSkuImgUploader: { + or: 'Or', + uploading: 'Uploading...', + rephoto: 'Take Again', + photo: 'Take', + reselect: 'Reselect', + select: 'Select Photo', + maxSize: maxSize => `The upload limit is up to ${maxSize}MB,please try to compress the photo` + }, vanSkuStepper: { title: 'Quantity', remain: count => `Remain ${count} items`, diff --git a/packages/locale/lang/zh-CN.js b/packages/locale/lang/zh-CN.js index 074fa1f3c..582b3c79a 100644 --- a/packages/locale/lang/zh-CN.js +++ b/packages/locale/lang/zh-CN.js @@ -117,10 +117,12 @@ export default { }, vanSkuMessages: { fill: '请填写', + upload: '请上传', number: '请填写正确的数字格式留言', email: '请填写正确的邮箱', 'id_no': '请填写正确的身份证号码', overlimit: '写的太多了,不要超过200字', + onePic: '仅限一张', placeholder: { 'id_no': '输入18位身份证号码', text: '输入文本', @@ -131,6 +133,15 @@ export default { textarea: '点击填写段落文本' } }, + vanSkuImgUploader: { + or: '或', + uploading: '正在上传...', + rephoto: '重拍', + photo: '拍照', + reselect: '重新选择照片', + select: '选择照片', + maxSize: maxSize => `最大可上传图片为${maxSize}MB,请尝试压缩图片尺寸` + }, vanSkuStepper: { title: '购买数量', remain: count => `剩余${count}件`, diff --git a/packages/mixins/popup/index.js b/packages/mixins/popup/index.js index 7b51213ea..399f38edf 100644 --- a/packages/mixins/popup/index.js +++ b/packages/mixins/popup/index.js @@ -19,6 +19,8 @@ export default { zIndex: [String, Number], // prevent touchmove scroll preventScroll: Boolean, + // return the mount node for popup + getContainer: Function, // prevent body scroll lockOnScroll: { type: Boolean, @@ -26,17 +28,8 @@ export default { } }, - watch: { - value(val) { - this[val ? 'open' : 'close'](); - } - }, - - beforeMount() { - this._popupId = 'popup-' + context.plusKey('idSeed'); - }, - data() { + this._popupId = 'popup-' + context.plusKey('idSeed'); return { opened: false, pos: { @@ -46,6 +39,29 @@ export default { }; }, + watch: { + value(val) { + this[val ? 'open' : 'close'](); + }, + + getContainer() { + this.move(); + } + }, + + mounted() { + if (this.getContainer) { + this.move(); + } + if (this.value) { + this.open(); + } + }, + + beforeDestroy() { + this.doAfterClose(); + }, + methods: { recordPosition(e) { this.pos = { @@ -65,12 +81,14 @@ export default { let status = '11'; + /* istanbul ignore next */ if (scrollTop === 0) { status = offsetHeight >= scrollHeight ? '00' : '01'; } else if (scrollTop + offsetHeight >= scrollHeight) { status = '10'; } + /* istanbul ignore next */ if ( status !== '11' && isVertical && @@ -82,6 +100,7 @@ export default { }, open() { + /* istanbul ignore next */ if (this.opened || this.$isServer) { return; } @@ -137,10 +156,14 @@ export default { off(document, 'touchstart', this.recordPosition); off(document, 'touchmove', this.watchTouchMove); } - } - }, + }, - beforeDestroy() { - this.doAfterClose(); + move() { + if (this.getContainer) { + this.getContainer().appendChild(this.$el); + } else if (this.$parent) { + this.$parent.$el.appendChild(this.$el); + } + } } }; diff --git a/packages/mixins/popup/manager.js b/packages/mixins/popup/manager.js index 319c8da89..bf2e1c104 100644 --- a/packages/mixins/popup/manager.js +++ b/packages/mixins/popup/manager.js @@ -41,6 +41,7 @@ const manager = { const { id, dom } = config; const exist = context.stack.some(item => item.id === id); + /* istanbul ignore next */ if (!exist) { const targetNode = dom && dom.parentNode && dom.parentNode.nodeType !== 11 ? dom.parentNode : document.body; context.stack.push({ instance, id, config, targetNode }); diff --git a/packages/picker/PickerColumn.vue b/packages/picker/PickerColumn.vue index 365973601..3ea162359 100644 --- a/packages/picker/PickerColumn.vue +++ b/packages/picker/PickerColumn.vue @@ -13,6 +13,7 @@
  • {{ cancelButtonText || $t('cancel') }}
    +
    {{ confirmButtonText || $t('confirm') }}
    -
    -
    +
    + +
    +
    diff --git a/packages/pull-refresh/index.vue b/packages/pull-refresh/index.vue index 82587b256..72c1a00d1 100644 --- a/packages/pull-refresh/index.vue +++ b/packages/pull-refresh/index.vue @@ -127,6 +127,7 @@ export default create({ if (this.status === 'loosing') { this.getStatus(this.headHeight, true); this.$emit('input', true); + this.$emit('refresh'); } else { this.getStatus(0); } diff --git a/packages/sku/containers/SkuContainer.vue b/packages/sku/Sku.vue similarity index 70% rename from packages/sku/containers/SkuContainer.vue rename to packages/sku/Sku.vue index a5c595d79..807ebfe77 100644 --- a/packages/sku/containers/SkuContainer.vue +++ b/packages/sku/Sku.vue @@ -1,8 +1,21 @@