refactor(test-app): convert dialog and overlay components to Class API
- Convert ErrorDialog to Class API with proper event handling - Convert LoadingOverlay to Class API with visibility prop - Add proper @Prop decorators and event emission methods - Simplify component logic for better maintainability Completes UI component conversion to vue-facing-decorator pattern.
This commit is contained in:
@@ -33,30 +33,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script lang="ts">
|
||||||
interface Props {
|
import { Vue, Component, Prop, toNative } from 'vue-facing-decorator'
|
||||||
message: string
|
|
||||||
}
|
@Component
|
||||||
|
class ErrorDialog extends Vue {
|
||||||
const props = defineProps<Props>()
|
@Prop({ type: String, required: true }) message!: string
|
||||||
|
handleOverlayClick() { this.$emit('close') }
|
||||||
const emit = defineEmits<{
|
handleClose() { this.$emit('close') }
|
||||||
close: []
|
handleRetry() { this.$emit('retry') }
|
||||||
retry: []
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const handleClose = (): void => {
|
|
||||||
emit('close')
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleRetry = (): void => {
|
|
||||||
emit('retry')
|
|
||||||
emit('close')
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleOverlayClick = (): void => {
|
|
||||||
handleClose()
|
|
||||||
}
|
}
|
||||||
|
export default toNative(ErrorDialog)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -18,8 +18,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script lang="ts">
|
||||||
// Loading overlay component - no props or logic needed
|
import { Vue, Component, Prop, toNative } from 'vue-facing-decorator'
|
||||||
|
|
||||||
|
@Component
|
||||||
|
class LoadingOverlay extends Vue {
|
||||||
|
@Prop({ type: Boolean, default: false }) visible!: boolean
|
||||||
|
}
|
||||||
|
export default toNative(LoadingOverlay)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user