chore: extract getSizeStyle

This commit is contained in:
chenjiahan
2020-08-26 18:09:32 +08:00
parent 47a7ccef85
commit 216417eae6
7 changed files with 29 additions and 53 deletions
+2 -12
View File
@@ -1,5 +1,5 @@
import { ref, computed } from 'vue';
import { createNamespace, addUnit } from '../utils';
import { createNamespace, addUnit, getSizeStyle } from '../utils';
import { preventDefault } from '../utils/dom/event';
// Mixins
@@ -51,16 +51,6 @@ export default createComponent({
const range = computed(() => props.max - props.min);
const buttonStyle = computed(() => {
if (props.buttonSize) {
const size = addUnit(props.buttonSize);
return {
width: size,
height: size,
};
}
});
const wrapperStyle = computed(() => {
const crossAxis = props.vertical ? 'width' : 'height';
return {
@@ -177,7 +167,7 @@ export default createComponent({
{slots.button ? (
slots.button()
) : (
<div class={bem('button')} style={buttonStyle.value} />
<div class={bem('button')} style={getSizeStyle(props.buttonSize)} />
)}
</div>
);