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 -10
View File
@@ -1,5 +1,5 @@
import { watch, computed } from 'vue';
import { createNamespace, isObject, addUnit } from '../utils';
import { createNamespace, isObject, getSizeStyle } from '../utils';
import { raf, cancelRaf } from '../utils/dom/raf';
import { BLUE, WHITE } from '../utils/constant';
@@ -69,14 +69,6 @@ export default createComponent({
const path = computed(() => getPath(props.clockwise, viewBoxSize.value));
const rootStyle = computed(() => {
const size = addUnit(props.size);
return {
width: size,
height: size,
};
});
watch(
() => props.rate,
(rate) => {
@@ -172,7 +164,7 @@ export default createComponent({
};
return () => (
<div class={bem()} style={rootStyle.value}>
<div class={bem()} style={getSizeStyle(props.buttonSize)}>
<svg viewBox={`0 0 ${viewBoxSize.value} ${viewBoxSize.value}`}>
{renderGradient()}
{renderHover()}