Merge branch 'master' of gitlab.qima-inc.com:fe/zanui-vue

This commit is contained in:
cookfront 2017-03-27 17:06:40 +08:00
commit ce12744207
5 changed files with 83 additions and 19 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@youzan/zanui-vue",
"version": "0.0.42",
"version": "0.0.44",
"description": "有赞vue wap组件库",
"main": "lib/zanui.js",
"style": "lib/zanui-css/index.css",

View File

@ -44,8 +44,14 @@ export default {
},
data() {
let value = this.value ? +this.value : +this.defaultValue;
const correctedValue = this.correctValue(value);
if (value !== correctedValue) {
value = correctedValue;
this.$emit('input', value);
}
return {
currentValue: this.value ? +this.value : +this.defaultValue
currentValue: value
};
},
@ -66,38 +72,37 @@ export default {
watch: {
currentValue(val) {
this.$emit('input', +val);
this.$emit('input', val);
this.$emit('change', val);
},
value(val) {
if (val) {
this.currentValue = +val;
this.currentValue = this.correctValue(+val);
}
}
},
methods: {
// value
correctValue(value) {
value = Math.max(this.min, value);
value = Math.min(this.max, value);
return value;
},
handleInputChange(event) {
let val = +event.target.value;
const max = +this.max;
const min = +this.min;
const val = +event.target.value;
if (val > max) {
val = max;
} else if (val < min) {
val = min;
}
this.currentValue = val;
this.currentValue = this.correctValue(val);
},
handleChange(type) {
if ((this.isMinusDisabled && type === 'minus') || (this.isPlusDisabled && type === 'plus')) {
this.$emit('overlimit', type);
return;
}
const step = +this.step;
const currentValue = +this.currentValue;
this.currentValue = type === 'minus' ? (currentValue - step) : (currentValue + step);
this.$emit('change', this.currentValue);
}
}
};

View File

@ -1,6 +1,6 @@
{
"name": "@youzan/zanui-css",
"version": "0.0.42",
"version": "0.0.44",
"description": "zanui css.",
"main": "lib/index.css",
"style": "lib/index.css",

View File

@ -80,7 +80,7 @@ if (typeof window !== 'undefined' && window.Vue) {
module.exports = {
install,
version: '0.0.42',
version: '0.0.44',
Button,
Switch,
Field,

View File

@ -237,6 +237,12 @@ async@1.x, async@^1.4.0, async@^1.5.0:
version "1.5.2"
resolved "http://registry.npm.qima-inc.com/async/download/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
async@2.1.2:
version "2.1.2"
resolved "http://registry.npm.qima-inc.com/async/download/async-2.1.2.tgz#612a4ab45ef42a70cde806bad86ee6db047e8385"
dependencies:
lodash "^4.14.0"
async@^2.1.2:
version "2.1.5"
resolved "http://registry.npm.qima-inc.com/async/download/async-2.1.5.tgz#e587c68580994ac67fc56ff86d3ac56bdbe810bc"
@ -1234,6 +1240,12 @@ code-point-at@^1.0.0:
version "1.1.0"
resolved "http://registry.npm.qima-inc.com/code-point-at/download/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
collections@^0.2.0:
version "0.2.2"
resolved "http://registry.npm.qima-inc.com/collections/download/collections-0.2.2.tgz#1f23026b2ef36f927eecc901e99c5f0d48fa334e"
dependencies:
weak-map "1.0.0"
color-convert@^1.3.0:
version "1.9.0"
resolved "http://registry.npm.qima-inc.com/color-convert/download/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a"
@ -2696,6 +2708,18 @@ getpass@^0.1.1:
dependencies:
assert-plus "^1.0.0"
gh-pages@^0.12.0:
version "0.12.0"
resolved "http://registry.npm.qima-inc.com/gh-pages/download/gh-pages-0.12.0.tgz#d951e3ed98b85699d4b0418eb1a15b1a04988dc1"
dependencies:
async "2.1.2"
commander "2.9.0"
globby "^6.1.0"
graceful-fs "4.1.10"
q "1.4.1"
q-io "1.13.2"
rimraf "^2.5.4"
glob-base@^0.3.0:
version "0.3.0"
resolved "http://registry.npm.qima-inc.com/glob-base/download/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4"
@ -2863,6 +2887,10 @@ good-listener@^1.2.0:
dependencies:
delegate "^3.1.2"
graceful-fs@4.1.10:
version "4.1.10"
resolved "http://registry.npm.qima-inc.com/graceful-fs/download/graceful-fs-4.1.10.tgz#f2d720c22092f743228775c75e3612632501f131"
graceful-fs@^3.0.0:
version "3.0.11"
resolved "http://registry.npm.qima-inc.com/graceful-fs/download/graceful-fs-3.0.11.tgz#7613c778a1afea62f25c630a086d7f3acbbdd818"
@ -4310,10 +4338,14 @@ mime-types@^2.1.12, mime-types@~2.1.11, mime-types@~2.1.13, mime-types@~2.1.7:
dependencies:
mime-db "~1.26.0"
mime@1.3.4, mime@1.3.x, mime@^1.3.4:
mime@1.3.4, mime@1.3.x, mime@^1.2.11, mime@^1.3.4:
version "1.3.4"
resolved "http://registry.npm.qima-inc.com/mime/download/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53"
mimeparse@^0.1.4:
version "0.1.4"
resolved "http://registry.npm.qima-inc.com/mimeparse/download/mimeparse-0.1.4.tgz#dafb02752370fd226093ae3152c271af01ac254a"
minimalistic-assert@^1.0.0:
version "1.0.0"
resolved "http://registry.npm.qima-inc.com/minimalistic-assert/download/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3"
@ -5409,7 +5441,22 @@ punycode@^1.2.4, punycode@^1.4.1:
version "1.4.1"
resolved "http://registry.npm.qima-inc.com/punycode/download/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
q@^1.1.2:
q-io@1.13.2:
version "1.13.2"
resolved "http://registry.npm.qima-inc.com/q-io/download/q-io-1.13.2.tgz#eea130d481ddb5e1aa1bc5a66855f7391d06f003"
dependencies:
collections "^0.2.0"
mime "^1.2.11"
mimeparse "^0.1.4"
q "^1.0.1"
qs "^1.2.1"
url2 "^0.0.0"
q@1.4.1:
version "1.4.1"
resolved "http://registry.npm.qima-inc.com/q/download/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e"
q@^1.0.1, q@^1.1.2:
version "1.5.0"
resolved "http://registry.npm.qima-inc.com/q/download/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1"
@ -5421,6 +5468,10 @@ qs@6.4.0, qs@~6.4.0:
version "6.4.0"
resolved "http://registry.npm.qima-inc.com/qs/download/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233"
qs@^1.2.1:
version "1.2.2"
resolved "http://registry.npm.qima-inc.com/qs/download/qs-1.2.2.tgz#19b57ff24dc2a99ce1f8bdf6afcda59f8ef61f88"
query-string@^4.1.0:
version "4.3.2"
resolved "http://registry.npm.qima-inc.com/query-string/download/query-string-4.3.2.tgz#ec0fd765f58a50031a3968c2431386f8947a5cdd"
@ -6551,6 +6602,10 @@ url-parse@^1.1.1:
querystringify "0.0.x"
requires-port "1.0.x"
url2@^0.0.0:
version "0.0.0"
resolved "http://registry.npm.qima-inc.com/url2/download/url2-0.0.0.tgz#4eaabd1d5c3ac90d62ab4485c998422865a04b1a"
url@^0.11.0:
version "0.11.0"
resolved "http://registry.npm.qima-inc.com/url/download/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1"
@ -6758,6 +6813,10 @@ watchpack@^1.3.1:
chokidar "^1.4.3"
graceful-fs "^4.1.2"
weak-map@1.0.0:
version "1.0.0"
resolved "http://registry.npm.qima-inc.com/weak-map/download/weak-map-1.0.0.tgz#b66e56a9df0bd25a76bbf1b514db129080614a37"
webidl-conversions@^2.0.0:
version "2.0.1"
resolved "http://registry.npm.qima-inc.com/webidl-conversions/download/webidl-conversions-2.0.1.tgz#3bf8258f7d318c7443c36f2e169402a1a6703506"