mirror of
https://github.com/hay-kot/mealie.git
synced 2025-07-15 17:43:53 -07:00
* Add clearable to RecipeRating, Fix #2534 * Make rating nullable --------- Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
This commit is contained in:
parent
2dfbe9f08d
commit
9a04b11ee5
2 changed files with 6 additions and 2 deletions
|
@ -10,6 +10,7 @@
|
||||||
:size="small ? 15 : undefined"
|
:size="small ? 15 : undefined"
|
||||||
hover
|
hover
|
||||||
:value="value"
|
:value="value"
|
||||||
|
clearable
|
||||||
@input="updateRating"
|
@input="updateRating"
|
||||||
@click="updateRating"
|
@click="updateRating"
|
||||||
></v-rating>
|
></v-rating>
|
||||||
|
@ -52,7 +53,10 @@ export default defineComponent({
|
||||||
const rating = ref(props.value);
|
const rating = ref(props.value);
|
||||||
|
|
||||||
const api = useUserApi();
|
const api = useUserApi();
|
||||||
function updateRating(val: number) {
|
function updateRating(val: number | null) {
|
||||||
|
if (val === 0) {
|
||||||
|
val = null;
|
||||||
|
}
|
||||||
if (!props.emitOnly) {
|
if (!props.emitOnly) {
|
||||||
api.recipes.patchOne(props.slug, {
|
api.recipes.patchOne(props.slug, {
|
||||||
rating: val,
|
rating: val,
|
||||||
|
|
|
@ -206,7 +206,7 @@ export interface Recipe {
|
||||||
recipeCategory?: RecipeCategory[];
|
recipeCategory?: RecipeCategory[];
|
||||||
tags?: RecipeTag[];
|
tags?: RecipeTag[];
|
||||||
tools?: RecipeTool[];
|
tools?: RecipeTool[];
|
||||||
rating?: number;
|
rating?: number | null;
|
||||||
orgURL?: string;
|
orgURL?: string;
|
||||||
dateAdded?: string;
|
dateAdded?: string;
|
||||||
dateUpdated?: string;
|
dateUpdated?: string;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue