mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-22 22:49:15 +08:00
fix: code style
This commit is contained in:
parent
43693fa781
commit
e7b1d70900
@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Popup from '../mixins/popup';
|
import Popup from '../mixins/popup';
|
||||||
import VanIcon from '../icon';
|
import Icon from '../icon';
|
||||||
import VanLoading from '../loading';
|
import Loading from '../loading';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'van-actionsheet',
|
name: 'van-actionsheet',
|
||||||
@ -37,8 +37,8 @@ export default {
|
|||||||
mixins: [Popup],
|
mixins: [Popup],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
[VanIcon.name]: VanIcon,
|
[Icon.name]: Icon,
|
||||||
[VanLoading.name]: VanLoading
|
[Loading.name]: Loading
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -5,21 +5,21 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'van-badge-group',
|
name: 'van-badge-group',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
// 当前激活 tab 面板的 key
|
// 当前激活 tab 面板的 key
|
||||||
activeKey: {
|
activeKey: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
default: 0
|
default: 0
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
badges: []
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
badges: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -51,7 +51,7 @@ export default {
|
|||||||
wrapperStyle() {
|
wrapperStyle() {
|
||||||
return {
|
return {
|
||||||
transform: `translate3d(${this.offset}px, 0, 0)`
|
transform: `translate3d(${this.offset}px, 0, 0)`
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -72,9 +72,8 @@ export default {
|
|||||||
if (direction > 0 && -offset > rightWidth * 0.4 && rightWidth > 0) {
|
if (direction > 0 && -offset > rightWidth * 0.4 && rightWidth > 0) {
|
||||||
this.swipeMove(-rightWidth);
|
this.swipeMove(-rightWidth);
|
||||||
this.resetSwipeStatus();
|
this.resetSwipeStatus();
|
||||||
}
|
|
||||||
// left
|
// 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.swipeMove(leftWidth);
|
||||||
this.resetSwipeStatus();
|
this.resetSwipeStatus();
|
||||||
} else {
|
} else {
|
||||||
|
@ -19,7 +19,7 @@ export default {
|
|||||||
name: 'van-datetime-picker',
|
name: 'van-datetime-picker',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
'van-picker': Picker
|
[Picker.name]: Picker
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -48,15 +48,15 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const VALID_TYPES = ['text', 'number', 'email', 'url', 'tel', 'date', 'time', 'datetime', 'password', 'textarea'];
|
const VALID_TYPES = ['text', 'number', 'email', 'url', 'tel', 'date', 'time', 'datetime', 'password', 'textarea'];
|
||||||
import vanCell from '../cell';
|
import Cell from '../cell';
|
||||||
import vanIcon from '../icon';
|
import Icon from '../icon';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'van-field',
|
name: 'van-field',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
vanCell,
|
[Cell.name]: Cell,
|
||||||
vanIcon
|
[Icon.name]: Icon
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Popup from '../mixins/popup';
|
import Popup from '../mixins/popup';
|
||||||
import VanSwipe from '../swipe';
|
import Swipe from '../swipe';
|
||||||
import VanSwipeItem from '../swipe-item';
|
import SwipeItem from '../swipe-item';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'van-image-preview',
|
name: 'van-image-preview',
|
||||||
@ -22,8 +22,8 @@ export default {
|
|||||||
mixins: [Popup],
|
mixins: [Popup],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
VanSwipe,
|
[Swipe.name]: Swipe,
|
||||||
VanSwipeItem
|
[SwipeItem.name]: SwipeItem
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="van-loading" :class="['van-loading--' + type]">
|
<div :class="['van-loading', 'van-loading--' + type]">
|
||||||
<span class="van-loading__spinner" :class="['van-loading__spinner--' + type, 'van-loading__spinner--' + color]"></span>
|
<span :class="['van-loading__spinner', 'van-loading__spinner--' + type, 'van-loading__spinner--' + color]"></span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const VALID_TYPES = ['gradient-circle', 'circle'];
|
const VALID_TYPES = ['gradient-circle', 'circle'];
|
||||||
const VALID_COLORS = ['black', 'white'];
|
const VALID_COLORS = ['black', 'white'];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'van-loading',
|
name: 'van-loading',
|
||||||
|
|
||||||
@ -14,16 +15,12 @@ export default {
|
|||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'gradient-circle',
|
default: 'gradient-circle',
|
||||||
validator(value) {
|
validator: value => VALID_TYPES.indexOf(value) > -1
|
||||||
return VALID_TYPES.indexOf(value) > -1;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'black',
|
default: 'black',
|
||||||
validator(value) {
|
validator: value => VALID_COLORS.indexOf(value) > -1
|
||||||
return VALID_COLORS.indexOf(value) > -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -82,7 +82,7 @@ const PopupManager = {
|
|||||||
|
|
||||||
let domParentNode;
|
let domParentNode;
|
||||||
if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
|
if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
|
||||||
domParentNode = dom.parentNode
|
domParentNode = dom.parentNode;
|
||||||
} else {
|
} else {
|
||||||
domParentNode = document.body;
|
domParentNode = document.body;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-picker__columns" :class="['van-picker__columns--' + columns.length]">
|
<div class="van-picker__columns" :class="['van-picker__columns--' + columns.length]">
|
||||||
<picker-column
|
<van-picker-column
|
||||||
v-for="(item, index) in columns"
|
v-for="(item, index) in columns"
|
||||||
:key="index"
|
:key="index"
|
||||||
v-model="values[index]"
|
v-model="values[index]"
|
||||||
@ -17,8 +17,8 @@
|
|||||||
:itemHeight="itemHeight"
|
:itemHeight="itemHeight"
|
||||||
:visible-item-count="visibileColumnCount"
|
:visible-item-count="visibileColumnCount"
|
||||||
:value-key="valueKey"
|
:value-key="valueKey"
|
||||||
@columnChange="columnValueChange(index)">
|
@columnChange="columnValueChange(index)"
|
||||||
</picker-column>
|
/>
|
||||||
<div class="van-picker-center-highlight" :style="{ height: itemHeight + 'px', marginTop: -itemHeight / 2 + 'px' }"></div>
|
<div class="van-picker-center-highlight" :style="{ height: itemHeight + 'px', marginTop: -itemHeight / 2 + 'px' }"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -33,7 +33,7 @@ export default {
|
|||||||
name: 'van-picker',
|
name: 'van-picker',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
PickerColumn
|
[PickerColumn.name]: PickerColumn
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -20,14 +20,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import VanIcon from '../icon';
|
import Icon from '../icon';
|
||||||
import Clickoutside from '../utils/clickoutside';
|
import Clickoutside from '../utils/clickoutside';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'van-search',
|
name: 'van-search',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
VanIcon
|
[Icon.name]: Icon
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -30,7 +30,7 @@ export default {
|
|||||||
name: 'van-steps',
|
name: 'van-steps',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
'van-icon': Icon
|
[Icon.name]: Icon
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -13,9 +13,9 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
destroyed() {
|
||||||
const index = this.$parent.swipes.indexOf(this)
|
const index = this.$parent.swipes.indexOf(this);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.$parent.swipes.splice(index, 1)
|
this.$parent.swipes.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -61,27 +61,27 @@ export default {
|
|||||||
}).on('autoPlay', function(dist, isEnd) {
|
}).on('autoPlay', function(dist, isEnd) {
|
||||||
scroll.movePage(dist.x, isEnd);
|
scroll.movePage(dist.x, isEnd);
|
||||||
});
|
});
|
||||||
this.dummy = dummy
|
this.dummy = dummy;
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
swipes(value) {
|
swipes(value) {
|
||||||
if (this.autoPlay && value.length > 1) {
|
if (this.autoPlay && value.length > 1) {
|
||||||
this.dummy.initMove()
|
this.dummy.initMove();
|
||||||
} else {
|
} else {
|
||||||
this.dummy.clearMove()
|
this.dummy.clearMove();
|
||||||
}
|
}
|
||||||
this.scroll.update();
|
this.scroll.update();
|
||||||
return value
|
return value;
|
||||||
},
|
},
|
||||||
|
|
||||||
autoPlay(value) {
|
autoPlay(value) {
|
||||||
if (value && this.swipes.length > 1) {
|
if (value && this.swipes.length > 1) {
|
||||||
this.dummy.initMove()
|
this.dummy.initMove();
|
||||||
} else {
|
} else {
|
||||||
this.dummy.clearMove()
|
this.dummy.clearMove();
|
||||||
}
|
}
|
||||||
return value
|
return value;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -8,22 +8,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import VanLoading from '../loading';
|
import Loading 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>
|
|
||||||
*/
|
|
||||||
export default {
|
export default {
|
||||||
name: 'van-switch',
|
name: 'van-switch',
|
||||||
components: {
|
components: {
|
||||||
'van-loading': VanLoading
|
[Loading.name]: Loading
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: Boolean,
|
value: Boolean,
|
||||||
|
@ -192,7 +192,7 @@
|
|||||||
const translate = swipeState.startTranslateLeft + deltaX;
|
const translate = swipeState.startTranslateLeft + deltaX;
|
||||||
|
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (translate > 0 || (translate * -1) > this.maxTranslate ) return;
|
if (translate > 0 || (translate * -1) > this.maxTranslate) return;
|
||||||
|
|
||||||
translateUtil.translateElement(el, translate, null);
|
translateUtil.translateElement(el, translate, null);
|
||||||
},
|
},
|
||||||
@ -200,7 +200,7 @@
|
|||||||
end: () => {
|
end: () => {
|
||||||
this.isSwiping = false;
|
this.isSwiping = false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
doOnValueChange() {
|
doOnValueChange() {
|
||||||
|
@ -12,9 +12,7 @@
|
|||||||
props: {
|
props: {
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
validator: function (val) {
|
validator: val => ~ALLOW_TYPE.indexOf(val)
|
||||||
return ~ALLOW_TYPE.indexOf(val);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mark: Boolean,
|
mark: Boolean,
|
||||||
plain: Boolean
|
plain: Boolean
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import vanLoading from '../loading';
|
import Icon from '../icon';
|
||||||
import vanIcon from '../icon';
|
import Loading from '../loading';
|
||||||
|
|
||||||
const TOAST_TYPES = ['text', 'html', 'loading', 'success', 'fail'];
|
const TOAST_TYPES = ['text', 'html', 'loading', 'success', 'fail'];
|
||||||
const DEFAULT_STYLE_LIST = ['success', 'fail'];
|
const DEFAULT_STYLE_LIST = ['success', 'fail'];
|
||||||
@ -37,8 +37,8 @@ export default {
|
|||||||
name: 'van-toast',
|
name: 'van-toast',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
'van-loading': vanLoading,
|
[Icon.name]: Icon,
|
||||||
'van-icon': vanIcon
|
[Loading.name]: Loading
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
type: {
|
type: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user