chore(Switch): remove inline style

This commit is contained in:
chenjiahan 2020-03-01 20:17:48 +08:00
parent df4439e9f6
commit 5d3333ca8c
4 changed files with 7 additions and 7 deletions

View File

@ -33,7 +33,7 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__value"> <div class="van-cell__value">
<div role="switch" aria-checked="true" class="van-switch van-switch--on van-switch--loading" style="font-size: 24px;"> <div role="switch" aria-checked="true" class="van-switch van-switch--on van-switch--loading" style="font-size: 24px;">
<div class="van-switch__node"> <div class="van-switch__node">
<div class="van-loading van-loading--circular van-switch__loading"><span class="van-loading__spinner van-loading__spinner--circular" style="color: rgb(25, 137, 250);"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div> <div class="van-loading van-loading--circular van-switch__loading"><span class="van-loading__spinner van-loading__spinner--circular"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,6 +1,5 @@
// Utils // Utils
import { createNamespace, addUnit } from '../utils'; import { createNamespace, addUnit } from '../utils';
import { BLUE } from '../utils/constant';
import { switchProps } from './shared'; import { switchProps } from './shared';
// Mixins // Mixins
@ -42,10 +41,7 @@ export default createComponent({
genLoading() { genLoading() {
if (this.loading) { if (this.loading) {
const color = this.checked const color = this.checked ? this.activeColor : this.inactiveColor;
? this.activeColor || BLUE
: this.inactiveColor || '';
return <Loading class={bem('loading')} color={color} />; return <Loading class={bem('loading')} color={color} />;
} }
}, },

View File

@ -41,6 +41,10 @@
.van-switch__node { .van-switch__node {
transform: translateX(@switch-width - @switch-node-size); transform: translateX(@switch-width - @switch-node-size);
} }
.van-switch__loading {
color: @switch-on-background-color;
}
} }
&--disabled { &--disabled {

View File

@ -15,7 +15,7 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div role="switch" aria-checked="true" class="van-switch van-switch--on van-switch--loading"> <div role="switch" aria-checked="true" class="van-switch van-switch--on van-switch--loading">
<div class="van-switch__node"> <div class="van-switch__node">
<div class="van-loading van-loading--circular van-switch__loading"><span class="van-loading__spinner van-loading__spinner--circular" style="color: rgb(25, 137, 250);"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div> <div class="van-loading van-loading--circular van-switch__loading"><span class="van-loading__spinner van-loading__spinner--circular"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>
</div> </div>
</div> </div>
</div> </div>