mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 12:42:01 +00:00
refactor: replace withDefaults with Vue 3.5 props destructuring (#9150)
## Summary - Replace all `withDefaults(defineProps<...>())` with Vue 3.5 reactive props destructuring across 14 components - Update `props.xxx` references to use destructured variables directly in script and template - Fixes #2334 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9150-refactor-replace-withDefaults-with-Vue-3-5-props-destructuring-3116d73d365081e7a721db3369600671) by [Unito](https://www.unito.io)
This commit is contained in:
committed by
GitHub
parent
be70f6c1e6
commit
724827d8cc
@@ -196,7 +196,7 @@
|
||||
<Button
|
||||
:variant="getButtonSeverity(tier)"
|
||||
:disabled="isButtonDisabled(tier)"
|
||||
:loading="props.loadingTier === tier.key"
|
||||
:loading="loadingTier === tier.key"
|
||||
:class="
|
||||
cn(
|
||||
'h-10 w-full',
|
||||
@@ -305,10 +305,7 @@ interface Props {
|
||||
loadingTier?: CheckoutTierKey | null
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
isLoading: false,
|
||||
loadingTier: null
|
||||
})
|
||||
const { isLoading = false, loadingTier = null } = defineProps<Props>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
subscribe: [payload: { tierKey: CheckoutTierKey; billingCycle: BillingCycle }]
|
||||
@@ -463,7 +460,7 @@ const getButtonSeverity = (
|
||||
}
|
||||
|
||||
const isButtonDisabled = (tier: PricingTierConfig): boolean => {
|
||||
if (props.isLoading) return true
|
||||
if (isLoading) return true
|
||||
if (isCurrentPlan(tier.key)) {
|
||||
// Allow clicking current plan button when cancelled (for resubscribe)
|
||||
return !isCancelled.value
|
||||
@@ -495,7 +492,7 @@ const getMonthlyCreditsPerMember = (tier: PricingTierConfig): number =>
|
||||
tier.pricing.credits
|
||||
|
||||
function handleSubscribe(tierKey: CheckoutTierKey) {
|
||||
if (props.isLoading) return
|
||||
if (isLoading) return
|
||||
|
||||
// Handle resubscribe for cancelled subscription on current plan
|
||||
if (isCurrentPlan(tierKey)) {
|
||||
|
||||
Reference in New Issue
Block a user