Skip to content

Commit

Permalink
Update colorSelector.vue
Browse files Browse the repository at this point in the history
防止从模板加载后出现colorStops报错
  • Loading branch information
ijry authored and Qiu-Jun committed May 7, 2024
1 parent 3611a93 commit dedce23
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/components/colorSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ const setGradientBar = (val) => {
// Fabric渐变bar背景设置
const fabricGradientToBar = (val) => {
// 百分比排序
if (!val?.colorStops) return // 防止从模板加载后出现colorStops报错
val.colorStops.sort((a, b) => a.offset - b.offset);
const str = val.colorStops.map((item) => `${item.color} ${item.offset * 100}%`);
bgStr.value = `background: linear-gradient(124deg, ${str});`;
Expand Down

0 comments on commit dedce23

Please sign in to comment.