Add component communication guide with function props preference
Create comprehensive development guide establishing our preferred patterns for Vue component communication. Document the preference for function props over $emit for business logic while reserving $emit for DOM-like events. Guide covers: - Function props for business logic, data operations, and complex interactions - $emit for DOM-like events, lifecycle events, and simple user interactions - Implementation patterns with TypeScript examples - Testing strategies for both approaches - Migration strategy from $emit to function props - Naming conventions and best practices Establishes consistent, maintainable component communication patterns across the application with focus on type safety and developer experience.
This commit is contained in:
@@ -81,7 +81,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue, Prop, Emit } from "vue-facing-decorator";
|
||||
import { Component, Vue, Prop } from "vue-facing-decorator";
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
@Component({
|
||||
@@ -96,6 +96,7 @@ export default class UsageLimitsSection extends Vue {
|
||||
@Prop({ required: false }) activeDid?: string;
|
||||
@Prop({ required: false }) endorserLimits?: any;
|
||||
@Prop({ required: false }) imageLimits?: any;
|
||||
@Prop({ required: true }) onRecheckLimits!: () => void;
|
||||
|
||||
mounted() {
|
||||
// Component mounted
|
||||
@@ -114,9 +115,8 @@ export default class UsageLimitsSection extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
@Emit("recheck-limits")
|
||||
recheckLimits() {
|
||||
// Emit recheck-limits event
|
||||
this.onRecheckLimits();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user