修改select默认value为0不能选定的Bug

This commit is contained in:
luffyzhao 2018-05-25 13:45:16 +08:00
parent 7468f04d84
commit 4107d6c4a5
2 changed files with 2 additions and 3 deletions

View file

@ -74,7 +74,7 @@
"cross-env": "^5.1.3", "cross-env": "^5.1.3",
"css-loader": "^0.28.10", "css-loader": "^0.28.10",
"eslint": "^3.19.0", "eslint": "^3.19.0",
"eslint-plugin-vue": "^2.1.0", "eslint-plugin-vue": "2.1.0",
"extract-text-webpack-plugin": "^2.1.2", "extract-text-webpack-plugin": "^2.1.2",
"file-loader": "^1.1.11", "file-loader": "^1.1.11",
"friendly-errors-webpack-plugin": "^1.6.1", "friendly-errors-webpack-plugin": "^1.6.1",
@ -109,7 +109,7 @@
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
"vue-style-loader": "^4.0.2", "vue-style-loader": "^4.0.2",
"vue-template-compiler": "^2.5.16", "vue-template-compiler": "^2.5.16",
"webpack": "^3.11.0", "webpack": "3.11.0",
"webpack-dev-server": "^2.11.1", "webpack-dev-server": "^2.11.1",
"webpack-merge": "^3.0.0" "webpack-merge": "^3.0.0"
}, },

View file

@ -410,7 +410,6 @@
getInitialValue(){ getInitialValue(){
const {multiple, value} = this; const {multiple, value} = this;
let initialValue = Array.isArray(value) ? value : [value]; let initialValue = Array.isArray(value) ? value : [value];
if (!multiple && (typeof initialValue[0] === 'undefined' || (String(initialValue[0]).trim() === '' && !Number.isFinite(initialValue[0])))) initialValue = [];
return initialValue.filter((item) => { return initialValue.filter((item) => {
return Boolean(item) || item === 0 return Boolean(item) || item === 0
}); });