fix: code style

This commit is contained in:
陈嘉涵 2017-08-25 15:57:38 +08:00
parent 43693fa781
commit e7b1d70900
18 changed files with 64 additions and 80 deletions

View File

@ -28,8 +28,8 @@
<script>
import Popup from '../mixins/popup';
import VanIcon from '../icon';
import VanLoading from '../loading';
import Icon from '../icon';
import Loading from '../loading';
export default {
name: 'van-actionsheet',
@ -37,8 +37,8 @@ export default {
mixins: [Popup],
components: {
[VanIcon.name]: VanIcon,
[VanLoading.name]: VanLoading
[Icon.name]: Icon,
[Loading.name]: Loading
},
props: {

View File

@ -5,7 +5,7 @@
</template>
<script>
export default {
export default {
name: 'van-badge-group',
props: {
@ -21,5 +21,5 @@
badges: []
};
}
};
};
</script>

View File

@ -51,7 +51,7 @@ export default {
wrapperStyle() {
return {
transform: `translate3d(${this.offset}px, 0, 0)`
}
};
}
},
@ -72,9 +72,8 @@ export default {
if (direction > 0 && -offset > rightWidth * 0.4 && rightWidth > 0) {
this.swipeMove(-rightWidth);
this.resetSwipeStatus();
}
// left
else if (direction < 0 && offset >leftWidth * 0.4 && leftWidth > 0) {
} else if (direction < 0 && offset > leftWidth * 0.4 && leftWidth > 0) {
this.swipeMove(leftWidth);
this.resetSwipeStatus();
} else {

View File

@ -19,7 +19,7 @@ export default {
name: 'van-datetime-picker',
components: {
'van-picker': Picker
[Picker.name]: Picker
},
props: {

View File

@ -48,15 +48,15 @@
<script>
const VALID_TYPES = ['text', 'number', 'email', 'url', 'tel', 'date', 'time', 'datetime', 'password', 'textarea'];
import vanCell from '../cell';
import vanIcon from '../icon';
import Cell from '../cell';
import Icon from '../icon';
export default {
name: 'van-field',
components: {
vanCell,
vanIcon
[Cell.name]: Cell,
[Icon.name]: Icon
},
props: {

View File

@ -13,8 +13,8 @@
<script>
import Vue from 'vue';
import Popup from '../mixins/popup';
import VanSwipe from '../swipe';
import VanSwipeItem from '../swipe-item';
import Swipe from '../swipe';
import SwipeItem from '../swipe-item';
export default {
name: 'van-image-preview',
@ -22,8 +22,8 @@ export default {
mixins: [Popup],
components: {
VanSwipe,
VanSwipeItem
[Swipe.name]: Swipe,
[SwipeItem.name]: SwipeItem
},
props: {

View File

@ -1,12 +1,13 @@
<template>
<div class="van-loading" :class="['van-loading--' + type]">
<span class="van-loading__spinner" :class="['van-loading__spinner--' + type, 'van-loading__spinner--' + color]"></span>
<div :class="['van-loading', 'van-loading--' + type]">
<span :class="['van-loading__spinner', 'van-loading__spinner--' + type, 'van-loading__spinner--' + color]"></span>
</div>
</template>
<script>
const VALID_TYPES = ['gradient-circle', 'circle'];
const VALID_COLORS = ['black', 'white'];
export default {
name: 'van-loading',
@ -14,16 +15,12 @@ export default {
type: {
type: String,
default: 'gradient-circle',
validator(value) {
return VALID_TYPES.indexOf(value) > -1;
}
validator: value => VALID_TYPES.indexOf(value) > -1
},
color: {
type: String,
default: 'black',
validator(value) {
return VALID_COLORS.indexOf(value) > -1;
}
validator: value => VALID_COLORS.indexOf(value) > -1
}
}
};

View File

@ -82,7 +82,7 @@ const PopupManager = {
let domParentNode;
if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
domParentNode = dom.parentNode
domParentNode = dom.parentNode;
} else {
domParentNode = document.body;
}

View File

@ -8,7 +8,7 @@
</slot>
</div>
<div class="van-picker__columns" :class="['van-picker__columns--' + columns.length]">
<picker-column
<van-picker-column
v-for="(item, index) in columns"
:key="index"
v-model="values[index]"
@ -17,8 +17,8 @@
:itemHeight="itemHeight"
:visible-item-count="visibileColumnCount"
:value-key="valueKey"
@columnChange="columnValueChange(index)">
</picker-column>
@columnChange="columnValueChange(index)"
/>
<div class="van-picker-center-highlight" :style="{ height: itemHeight + 'px', marginTop: -itemHeight / 2 + 'px' }"></div>
</div>
</div>
@ -33,7 +33,7 @@ export default {
name: 'van-picker',
components: {
PickerColumn
[PickerColumn.name]: PickerColumn
},
props: {

View File

@ -20,14 +20,14 @@
</template>
<script>
import VanIcon from '../icon';
import Icon from '../icon';
import Clickoutside from '../utils/clickoutside';
export default {
name: 'van-search',
components: {
VanIcon
[Icon.name]: Icon
},
props: {

View File

@ -30,7 +30,7 @@ export default {
name: 'van-steps',
components: {
'van-icon': Icon
[Icon.name]: Icon
},
props: {

View File

@ -13,9 +13,9 @@ export default {
},
destroyed() {
const index = this.$parent.swipes.indexOf(this)
const index = this.$parent.swipes.indexOf(this);
if (index > -1) {
this.$parent.swipes.splice(index, 1)
this.$parent.swipes.splice(index, 1);
}
}
};

View File

@ -61,27 +61,27 @@ export default {
}).on('autoPlay', function(dist, isEnd) {
scroll.movePage(dist.x, isEnd);
});
this.dummy = dummy
this.dummy = dummy;
},
watch: {
swipes(value) {
if (this.autoPlay && value.length > 1) {
this.dummy.initMove()
this.dummy.initMove();
} else {
this.dummy.clearMove()
this.dummy.clearMove();
}
this.scroll.update();
return value
return value;
},
autoPlay(value) {
if (value && this.swipes.length > 1) {
this.dummy.initMove()
this.dummy.initMove();
} else {
this.dummy.clearMove()
this.dummy.clearMove();
}
return value
return value;
}
},

View File

@ -8,22 +8,12 @@
</template>
<script>
import VanLoading from '../loading';
/**
* van-switch
* @module components/switch
* @desc 开关
* @param {boolean} [value=false] - 开关状态
* @param {boolean} [disabled=false] - 禁用
* @param {boolean} [loading=false] - loading状态
*
* @example
* <van-switch :checked="true" :disabled="false"></van-switch>
*/
import Loading from '../loading';
export default {
name: 'van-switch',
components: {
'van-loading': VanLoading
[Loading.name]: Loading
},
props: {
value: Boolean,

View File

@ -192,7 +192,7 @@
const translate = swipeState.startTranslateLeft + deltaX;
/* istanbul ignore else */
if (translate > 0 || (translate * -1) > this.maxTranslate ) return;
if (translate > 0 || (translate * -1) > this.maxTranslate) return;
translateUtil.translateElement(el, translate, null);
},
@ -200,7 +200,7 @@
end: () => {
this.isSwiping = false;
}
})
});
},
doOnValueChange() {

View File

@ -12,9 +12,7 @@
props: {
type: {
type: String,
validator: function (val) {
return ~ALLOW_TYPE.indexOf(val);
}
validator: val => ~ALLOW_TYPE.indexOf(val)
},
mark: Boolean,
plain: Boolean

View File

@ -20,8 +20,8 @@
</template>
<script>
import vanLoading from '../loading';
import vanIcon from '../icon';
import Icon from '../icon';
import Loading from '../loading';
const TOAST_TYPES = ['text', 'html', 'loading', 'success', 'fail'];
const DEFAULT_STYLE_LIST = ['success', 'fail'];
@ -37,8 +37,8 @@ export default {
name: 'van-toast',
components: {
'van-loading': vanLoading,
'van-icon': vanIcon
[Icon.name]: Icon,
[Loading.name]: Loading
},
props: {
type: {