forked from jigneshbhimani/VueJs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9DataBinding.txt
46 lines (40 loc) · 1.21 KB
/
9DataBinding.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
What is data binding
make a component
Define property
Make data binding
Data Binding with multi-line
1) Make a component DataBind.vue
- src/components/DataBind.vue:
<template>
<div>
<p style="white-space:pre-line">{{message}}</p> // white-space:pre-line atle new line lakhi to new line ma message show kare
<textarea type="text" v-model="message"> // Input me jo bhi likhege Wo message show hoga
</div>
</template>
<script>
export default {
name: 'DataBind',
data(){
return{
message: 'Hi'
}
}
}
</script>
2) Import DataBind.vue component in App.vue
- src/App.vue:
<template>
<div id="app">
<h1>Data Binding in VueJs</h1>
<Home />
</div>
</template>
<script>
import DataBind from "./components/DataBind.vue";
export default {
name: "App",
components: {
DataBind,
},
};
</script>