forked from trent_larson/crowd-funder-for-time-pwa
Convert Vue components to use @Emit decorator instead of manual emits declarations
Replace manual emits declarations with proper @Emit decorator usage across components:
- ActivityListItem: Add @Emit methods for viewImage, loadClaim, confirmClaim
- ContactInputForm: Convert handleQRScan to use @Emit("qr-scan")
- ContactBulkActions: Add @Emit methods for toggle-all-selection, copy-selected
- ContactListHeader: Add @Emit methods for all 5 emitted events
- MembersList: Add @Emit("error") method for error handling
- LargeIdenticonModal: Add @Emit("close") method
- ContactListItem: Add @Emit methods for all 4 emitted events
Update all templates to call emit methods instead of direct $emit calls.
Fix TypeScript type issues with optional parameters.
Resolves Vue warning about undeclared emitted events.
Follows vue-facing-decorator best practices and improves code consistency.
This commit is contained in:
@@ -8,21 +8,21 @@
|
||||
:checked="allContactsSelected"
|
||||
class="align-middle ml-2 h-6 w-6"
|
||||
data-testId="contactCheckAllTop"
|
||||
@click="$emit('toggle-all-selection')"
|
||||
@click="emitToggleAllSelection"
|
||||
/>
|
||||
<button
|
||||
v-if="!showGiveNumbers"
|
||||
:class="copyButtonClass"
|
||||
:disabled="copyButtonDisabled"
|
||||
data-testId="copySelectedContactsButtonTop"
|
||||
@click="$emit('copy-selected')"
|
||||
@click="emitCopySelected"
|
||||
>
|
||||
Copy
|
||||
</button>
|
||||
<font-awesome
|
||||
icon="circle-info"
|
||||
class="text-2xl text-blue-500 ml-2"
|
||||
@click="$emit('show-copy-info')"
|
||||
@click="emitShowCopyInfo"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -33,7 +33,7 @@
|
||||
v-if="showGiveNumbers"
|
||||
class="text-md bg-gradient-to-b shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-3 py-1.5 rounded-md"
|
||||
:class="giveAmountsButtonClass"
|
||||
@click="$emit('toggle-give-totals')"
|
||||
@click="emitToggleGiveTotals"
|
||||
>
|
||||
{{ giveAmountsButtonText }}
|
||||
<font-awesome icon="left-right" class="fa-fw" />
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
<button
|
||||
class="text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-3 py-1.5 rounded-md"
|
||||
@click="$emit('toggle-show-actions')"
|
||||
@click="emitToggleShowActions"
|
||||
>
|
||||
{{ showActionsButtonText }}
|
||||
</button>
|
||||
@@ -50,7 +50,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue, Prop } from "vue-facing-decorator";
|
||||
import { Component, Vue, Prop, Emit } from "vue-facing-decorator";
|
||||
|
||||
/**
|
||||
* ContactListHeader - Contact list header component
|
||||
@@ -71,5 +71,31 @@ export default class ContactListHeader extends Vue {
|
||||
@Prop({ required: true }) giveAmountsButtonText!: string;
|
||||
@Prop({ required: true }) showActionsButtonText!: string;
|
||||
@Prop({ required: true }) giveAmountsButtonClass!: Record<string, boolean>;
|
||||
|
||||
// Emit methods using @Emit decorator
|
||||
@Emit("toggle-all-selection")
|
||||
emitToggleAllSelection() {
|
||||
// No parameters needed
|
||||
}
|
||||
|
||||
@Emit("copy-selected")
|
||||
emitCopySelected() {
|
||||
// No parameters needed
|
||||
}
|
||||
|
||||
@Emit("show-copy-info")
|
||||
emitShowCopyInfo() {
|
||||
// No parameters needed
|
||||
}
|
||||
|
||||
@Emit("toggle-give-totals")
|
||||
emitToggleGiveTotals() {
|
||||
// No parameters needed
|
||||
}
|
||||
|
||||
@Emit("toggle-show-actions")
|
||||
emitToggleShowActions() {
|
||||
// No parameters needed
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user