Skip to content

Commit 7d7047b

Browse files
committed
Refactor HelloVue component for better reusability.
Added a `data` object to centralize attribute bindings and replaced hardcoded class bindings with dynamic bindings using `v-bind`. Introduced a `buttonDisabled` property to manage button state dynamically. These changes improve maintainability and flexibility of the component.
1 parent 5be2c0d commit 7d7047b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/components/HelloVue.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,21 @@
22
console.info("Hello Vue");
33
44
const hello = "<h1>Hello Vue</h1>"
5+
6+
const data = {
7+
class: "hello",
8+
id: "hello"
9+
};
10+
11+
const buttonDisabled = false;
512
</script>
613

714
<template>
8-
<h1 class="hello">{{hello}}</h1>
15+
<h1 v-bind="data">{{hello}}</h1>
16+
17+
<div :class="data.class" v-html="hello"></div>
918

10-
<div v-html="hello"></div>
19+
<button :disabled="buttonDisabled">This is Button</button>
1120
</template>
1221

1322
<style scoped>

0 commit comments

Comments
 (0)