This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

优化表单组件样式;优化组件解析:disbaled和:loading允许取反

old
宇天 2018-07-02 02:18:48 +08:00
parent 9318415454
commit 29a42aa21e
5 changed files with 93 additions and 1 deletions

View File

@ -3838,8 +3838,20 @@ const _Anot = (function() {
if (props.hasOwnProperty(':disabled')) { if (props.hasOwnProperty(':disabled')) {
var disabledKey = props[':disabled'] var disabledKey = props[':disabled']
var disabledKeyReverse = false
if (disabledKey.indexOf('!') === 0) {
disabledKey = disabledKey.slice(1)
disabledKeyReverse = true
}
state.disabled = parseVmValue(parentVm, disabledKey) state.disabled = parseVmValue(parentVm, disabledKey)
if (disabledKeyReverse) {
state.disabled = !state.disabled
}
parentVm.$watch(disabledKey, function(val) { parentVm.$watch(disabledKey, function(val) {
if (disabledKeyReverse) {
val = !val
}
parentVm.$fire('component!' + $id + '!disabled', val) parentVm.$fire('component!' + $id + '!disabled', val)
}) })
@ -3847,8 +3859,19 @@ const _Anot = (function() {
} }
if (props.hasOwnProperty(':loading')) { if (props.hasOwnProperty(':loading')) {
var loadingKey = props[':loading'] var loadingKey = props[':loading']
var loadingKeyReverse = false
if (loadingKey.indexOf('!') === 0) {
loadingKey = loadingKey.slice(1)
loadingKeyReverse = true
}
state.loading = parseVmValue(parentVm, loadingKey) state.loading = parseVmValue(parentVm, loadingKey)
if (loadingKeyReverse) {
state.loading = !state.loading
}
parentVm.$watch(loadingKey, function(val) { parentVm.$watch(loadingKey, function(val) {
if (loadingKeyReverse) {
val = !val
}
parentVm.$fire('component!' + $id + '!loading', val) parentVm.$fire('component!' + $id + '!loading', val)
}) })
delete props[':loading'] delete props[':loading']

View File

@ -3853,8 +3853,20 @@
if (props.hasOwnProperty(':disabled')) { if (props.hasOwnProperty(':disabled')) {
var disabledKey = props[':disabled'] var disabledKey = props[':disabled']
var disabledKeyReverse = false
if (disabledKey.indexOf('!') === 0) {
disabledKey = disabledKey.slice(1)
disabledKeyReverse = true
}
state.disabled = parseVmValue(parentVm, disabledKey) state.disabled = parseVmValue(parentVm, disabledKey)
if (disabledKeyReverse) {
state.disabled = !state.disabled
}
parentVm.$watch(disabledKey, function(val) { parentVm.$watch(disabledKey, function(val) {
if (disabledKeyReverse) {
val = !val
}
parentVm.$fire('component!' + $id + '!disabled', val) parentVm.$fire('component!' + $id + '!disabled', val)
}) })
@ -3862,8 +3874,19 @@
} }
if (props.hasOwnProperty(':loading')) { if (props.hasOwnProperty(':loading')) {
var loadingKey = props[':loading'] var loadingKey = props[':loading']
var loadingKeyReverse = false
if (loadingKey.indexOf('!') === 0) {
loadingKey = loadingKey.slice(1)
loadingKeyReverse = true
}
state.loading = parseVmValue(parentVm, loadingKey) state.loading = parseVmValue(parentVm, loadingKey)
if (loadingKeyReverse) {
state.loading = !state.loading
}
parentVm.$watch(loadingKey, function(val) { parentVm.$watch(loadingKey, function(val) {
if (loadingKeyReverse) {
val = !val
}
parentVm.$fire('component!' + $id + '!loading', val) parentVm.$fire('component!' + $id + '!loading', val)
}) })
delete props[':loading'] delete props[':loading']

View File

@ -3838,8 +3838,20 @@ const _Anot = (function() {
if (props.hasOwnProperty(':disabled')) { if (props.hasOwnProperty(':disabled')) {
var disabledKey = props[':disabled'] var disabledKey = props[':disabled']
var disabledKeyReverse = false
if (disabledKey.indexOf('!') === 0) {
disabledKey = disabledKey.slice(1)
disabledKeyReverse = true
}
state.disabled = parseVmValue(parentVm, disabledKey) state.disabled = parseVmValue(parentVm, disabledKey)
if (disabledKeyReverse) {
state.disabled = !state.disabled
}
parentVm.$watch(disabledKey, function(val) { parentVm.$watch(disabledKey, function(val) {
if (disabledKeyReverse) {
val = !val
}
parentVm.$fire('component!' + $id + '!disabled', val) parentVm.$fire('component!' + $id + '!disabled', val)
}) })
@ -3847,8 +3859,19 @@ const _Anot = (function() {
} }
if (props.hasOwnProperty(':loading')) { if (props.hasOwnProperty(':loading')) {
var loadingKey = props[':loading'] var loadingKey = props[':loading']
var loadingKeyReverse = false
if (loadingKey.indexOf('!') === 0) {
loadingKey = loadingKey.slice(1)
loadingKeyReverse = true
}
state.loading = parseVmValue(parentVm, loadingKey) state.loading = parseVmValue(parentVm, loadingKey)
if (loadingKeyReverse) {
state.loading = !state.loading
}
parentVm.$watch(loadingKey, function(val) { parentVm.$watch(loadingKey, function(val) {
if (loadingKeyReverse) {
val = !val
}
parentVm.$fire('component!' + $id + '!loading', val) parentVm.$fire('component!' + $id + '!loading', val)
}) })
delete props[':loading'] delete props[':loading']

View File

@ -3853,8 +3853,20 @@
if (props.hasOwnProperty(':disabled')) { if (props.hasOwnProperty(':disabled')) {
var disabledKey = props[':disabled'] var disabledKey = props[':disabled']
var disabledKeyReverse = false
if (disabledKey.indexOf('!') === 0) {
disabledKey = disabledKey.slice(1)
disabledKeyReverse = true
}
state.disabled = parseVmValue(parentVm, disabledKey) state.disabled = parseVmValue(parentVm, disabledKey)
if (disabledKeyReverse) {
state.disabled = !state.disabled
}
parentVm.$watch(disabledKey, function(val) { parentVm.$watch(disabledKey, function(val) {
if (disabledKeyReverse) {
val = !val
}
parentVm.$fire('component!' + $id + '!disabled', val) parentVm.$fire('component!' + $id + '!disabled', val)
}) })
@ -3862,8 +3874,19 @@
} }
if (props.hasOwnProperty(':loading')) { if (props.hasOwnProperty(':loading')) {
var loadingKey = props[':loading'] var loadingKey = props[':loading']
var loadingKeyReverse = false
if (loadingKey.indexOf('!') === 0) {
loadingKey = loadingKey.slice(1)
loadingKeyReverse = true
}
state.loading = parseVmValue(parentVm, loadingKey) state.loading = parseVmValue(parentVm, loadingKey)
if (loadingKeyReverse) {
state.loading = !state.loading
}
parentVm.$watch(loadingKey, function(val) { parentVm.$watch(loadingKey, function(val) {
if (loadingKeyReverse) {
val = !val
}
parentVm.$fire('component!' + $id + '!loading', val) parentVm.$fire('component!' + $id + '!loading', val)
}) })
delete props[':loading'] delete props[':loading']

View File

@ -222,7 +222,7 @@
&.icon-left {padding-left:30px;} &.icon-left {padding-left:30px;}
&.icon-right {padding-right:30px;} &.icon-right {padding-right:30px;}
&__holder {visibility:hidden;position:absolute;bottom:0;left:0;width:100%;height:30px;color: nth($cp, 3);@include ts(bottom, .2s); &__holder {visibility:hidden;position:absolute;bottom:0;left:0;width:100%;height:30px;padding:0 5px;color: nth($cp, 3);@include ts(bottom, .2s);
&.visible {visibility:visible;} &.visible {visibility:visible;}
} }