Commit 66d7fcfc500e1f848586f8951585e67e135057d8
1 parent
8a6838f4
perf(external/Componse): 修复大标题无法自适应
Showing
2 changed files
with
33 additions
and
25 deletions
| @@ -11,10 +11,10 @@ export const option = { | @@ -11,10 +11,10 @@ export const option = { | ||
| 11 | y: 0, | 11 | y: 0, |
| 12 | w: 1920, | 12 | w: 1920, |
| 13 | h: 100, | 13 | h: 100, |
| 14 | - size: 40, | 14 | + size: 20, |
| 15 | textPos:{ | 15 | textPos:{ |
| 16 | x: 50, | 16 | x: 50, |
| 17 | - y: 0, | 17 | + y: 10, |
| 18 | }, | 18 | }, |
| 19 | gradient: { | 19 | gradient: { |
| 20 | from: '#0000FFFF', | 20 | from: '#0000FFFF', |
| 1 | <template> | 1 | <template> |
| 2 | +<!-- 10 | ||
| 3 | +0,2 54,2 60,4 75,4 81,6 216,6 225,4 240,4 245.3,2 300,2 | ||
| 4 | +90,8 210,8 | ||
| 5 | +20 | ||
| 6 | +0,4 54,4 60,8 75,8 81,12 216,12 225,8 240,8 245.3,4 300,4 | ||
| 7 | +90,16 210,16 | ||
| 8 | +30 | ||
| 9 | +0,6 54,6 60,12 75,12 81,18 216,18 225,12 240,12 245.3,6 300,6 | ||
| 10 | +90,24 210,24 | ||
| 11 | +40 | ||
| 12 | +0,8 54,8 60,16 75,16 81,24 216,24 225,16 240,16 245.3,8 300,8 --> | ||
| 13 | +<!-- 200 200 | ||
| 14 | +60,160 140,160 --> | ||
| 15 | + | ||
| 2 | <div class="go-animat"> | 16 | <div class="go-animat"> |
| 3 | - <div class="go-animat-item" :style="{ marginLeft: animat.x + 'px', marginTop: animat.y + 'px' }"> | 17 | + <div class="go-svg" :style="{ marginLeft: animat.x + 'px', marginTop: animat.y + 'px' }"> |
| 4 | <svg :width="w" :height="h"> | 18 | <svg :width="w" :height="h"> |
| 5 | <polyline | 19 | <polyline |
| 6 | fill="transparent" | 20 | fill="transparent" |
| 7 | stroke-width="3" | 21 | stroke-width="3" |
| 8 | - :points="`0,20 ${w / 5.555555555555556},20 ${w / 5},40 ${w / 4},40 ${ | ||
| 9 | - w / 3.703703703703704 | ||
| 10 | - },60 ${w / 1.388888888888889},60 ${w / 1.333333333333333},40 ${w / 1.25},40 ${ | ||
| 11 | - w / 1.219512195121951 | ||
| 12 | - },20 ${w},20`" | 22 | + :points="`0,${h / 5} ${w / 5.555555555555556},${h / 5} ${w / 5},${h/2.5} ${w / 4},${h/2.5} ${w / 3.703703703703704},${h/1.666666666666667} ${ |
| 23 | + w / 1.388888888888889 | ||
| 24 | + },${h/1.666666666666667} ${w / 1.333333333333333},${h/2.5} ${w / 1.25},${h/2.5} ${w / 1.219512195121951},${h / 5} ${w},${h / 5}`" | ||
| 13 | :stroke="animat.colors[0]" | 25 | :stroke="animat.colors[0]" |
| 14 | > | 26 | > |
| 15 | <animate | 27 | <animate |
| @@ -28,7 +40,7 @@ | @@ -28,7 +40,7 @@ | ||
| 28 | <polyline | 40 | <polyline |
| 29 | fill="transparent" | 41 | fill="transparent" |
| 30 | stroke-width="2" | 42 | stroke-width="2" |
| 31 | - :points="`${w / 3.333333333333333},80 ${w / 1.428571428571429},80`" | 43 | + :points="`${w / 3.333333333333333},${h/1.25} ${w / 1.428571428571429},${h/1.25}`" |
| 32 | :stroke="animat.colors[1]" | 44 | :stroke="animat.colors[1]" |
| 33 | > | 45 | > |
| 34 | <animate | 46 | <animate |
| @@ -45,11 +57,11 @@ | @@ -45,11 +57,11 @@ | ||
| 45 | ></animate> | 57 | ></animate> |
| 46 | </polyline> | 58 | </polyline> |
| 47 | </svg> | 59 | </svg> |
| 48 | - <div class="go-text" :style="{ top: animat.textPos.y + '%', left: animat.textPos.x + '%' }"> | ||
| 49 | - <n-gradient-text :size="animat.size" :gradient="animat.gradient"> | ||
| 50 | - {{ animat.text }} | ||
| 51 | - </n-gradient-text> | ||
| 52 | - </div> | 60 | + </div> |
| 61 | + <div class="go-text" :style="{ top: animat.textPos.y + '%', left: animat.textPos.x + '%' }"> | ||
| 62 | + <n-gradient-text :size="animat.size" :gradient="animat.gradient"> | ||
| 63 | + {{ animat.text }} | ||
| 64 | + </n-gradient-text> | ||
| 53 | </div> | 65 | </div> |
| 54 | </div> | 66 | </div> |
| 55 | </template> | 67 | </template> |
| @@ -64,12 +76,6 @@ const props = defineProps({ | @@ -64,12 +76,6 @@ const props = defineProps({ | ||
| 64 | } | 76 | } |
| 65 | }) | 77 | }) |
| 66 | 78 | ||
| 67 | -//默认设置宽高距离位置 | ||
| 68 | -props.chartConfig.attr.w = 1920 | ||
| 69 | -props.chartConfig.attr.h = 300 | ||
| 70 | -props.chartConfig.attr.x = 0 | ||
| 71 | -props.chartConfig.attr.y = 0 | ||
| 72 | - | ||
| 73 | const { w, h } = toRefs(props.chartConfig.attr) | 79 | const { w, h } = toRefs(props.chartConfig.attr) |
| 74 | 80 | ||
| 75 | const { animat } = toRefs(props.chartConfig.option) | 81 | const { animat } = toRefs(props.chartConfig.option) |
| @@ -77,17 +83,19 @@ const { animat } = toRefs(props.chartConfig.option) | @@ -77,17 +83,19 @@ const { animat } = toRefs(props.chartConfig.option) | ||
| 77 | 83 | ||
| 78 | <style lang="scss" scoped> | 84 | <style lang="scss" scoped> |
| 79 | .go-animat { | 85 | .go-animat { |
| 80 | - width: 1920px; | ||
| 81 | - height: 1080px; | 86 | + width: v-bind('w+"px"'); |
| 87 | + height: v-bind('h+"px"'); | ||
| 82 | display: flex; | 88 | display: flex; |
| 83 | - margin: 0 auto; | ||
| 84 | justify-content: center; | 89 | justify-content: center; |
| 85 | align-items: center; | 90 | align-items: center; |
| 86 | - .go-animat-item { | ||
| 87 | - position: relative; | 91 | + position: relative; |
| 92 | + .go-svg { | ||
| 88 | } | 93 | } |
| 89 | .go-text { | 94 | .go-text { |
| 90 | position: absolute; | 95 | position: absolute; |
| 96 | + left: 50%; | ||
| 97 | + top: 50%; | ||
| 98 | + transform: translate(-50%, -50%); | ||
| 91 | } | 99 | } |
| 92 | } | 100 | } |
| 93 | </style> | 101 | </style> |