Skip to content

Commit

Permalink
fix: loader prop validation
Browse files Browse the repository at this point in the history
  • Loading branch information
setaman committed Dec 27, 2020
1 parent 9c0347b commit ee378a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
:size="200"
:progress="progress"
:thickness="10"
:loading="loading"
:color-fill="emptyColorFill"
dash="strict 60 0.5"
:loader="{ opacity: '1' }"
:empty-thickness="10"
>
<template v-slot:default="{ counterTick }">
Expand Down
9 changes: 8 additions & 1 deletion src/components/interface.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isValidNumber } from "@/utils";

const colorConfig = (defaultColor = "transparent") => ({
type: [String, Object],
required: false,
Expand All @@ -14,7 +16,12 @@ const colorConfig = (defaultColor = "transparent") => ({
});

const validateLoaderProps = (loaderOptions) =>
Object.keys(loaderOptions).every((option) => options[option].validator(loaderOptions[option]));
Object.keys(loaderOptions).every((option) => {
if (option === "opacity") {
return isValidNumber(loaderOptions[option] && loaderOptions[option] >= 0);
}
return options[option].validator(loaderOptions[option]);
});

const linePosition = {
type: String,
Expand Down

0 comments on commit ee378a7

Please sign in to comment.