Skip to content

Commit

Permalink
other: pkg version
Browse files Browse the repository at this point in the history
  • Loading branch information
lynsun committed Jan 17, 2017
1 parent a05990b commit d840fc0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
node_modules
npm-debug.log
_site
lib
coverage
vue-component.sublime-project

vue-component.sublime-workspace
.idea/
lib/
.idea/
34 changes: 22 additions & 12 deletions lib/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,18 +207,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (me.multiple || me.tags) {
me.multipleSelect = true;
}
if (me.defaultValue === null) {
value = me.multipleSelect ? [] : '';
}
if (me.multipleSelect && !Array.isArray(me.defaultValue)) {
value = [me.defaultValue];
}
if (!me.multipleSelect && Array.isArray(me.defaultValue)) {
value = me.defaultValue.slice(0, 1);
}
if (me.multipleSelect && me.defaultValue.length > me.limit) {
value = me.defaultValue.slice(0, me.limit);
}
value = me.getValue();
if (me.defaultValue !== null || me.selectedOptions.length) {
me.showPlaceholder = false;
}
Expand Down Expand Up @@ -283,6 +272,9 @@ return /******/ (function(modules) { // webpackBootstrap
},

watch: {
defaultValue: function defaultValue(val) {
this.value = this.getValue();
},
value: function value(val) {
var _this = this;

Expand Down Expand Up @@ -339,6 +331,24 @@ return /******/ (function(modules) { // webpackBootstrap
},

methods: {
getValue: function getValue(defaultValue) {
var me = this;
var value = me.defaultValue;
if (me.defaultValue === null) {
value = me.multipleSelect ? [] : '';
}
if (me.multipleSelect && !Array.isArray(me.defaultValue)) {
value = [me.defaultValue];
}
if (!me.multipleSelect && Array.isArray(me.defaultValue)) {
value = me.defaultValue.slice(0, 1);
}
if (me.multipleSelect && me.defaultValue.length > me.limit) {
value = me.defaultValue.slice(0, me.limit);
}

return value;
},
setValue: function setValue(value) {
this.value = value;
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "atui",
"version": "0.0.11",
"version": "0.0.12",
"description": "components built with Vue.js",
"main": "dist/atui.js",
"repository": {
Expand Down

0 comments on commit d840fc0

Please sign in to comment.