2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-24 12:20:35 +03:00

width allow css units

This commit is contained in:
mxie
2018-04-25 09:52:55 +08:00
parent d3f83aaa5c
commit 106574aadd
+3 -7
View File
@@ -211,15 +211,11 @@ export default {
return '' return ''
}, },
computedWidth () { computedWidth () {
if (typeof this.width === 'string' && this.width.match(/(px|%|rem|em|ex)$/)) { if ((typeof this.width === 'string' && /^\d+$/.test(this.width)) || typeof this.width === 'number') {
return this.width
}
if (typeof this.width === 'string') {
return this.width.replace(/\D/g,'') + 'px'
}
return this.width + 'px' return this.width + 'px'
} }
return this.width
}
}, },
methods: { methods: {
handleInput (event) { handleInput (event) {