s8e111 callbacks
This commit is contained in:
parent
abd9b87b96
commit
e421d3c06b
@ -6,7 +6,11 @@
|
|||||||
<hr>
|
<hr>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-6">
|
<div class="col-xs-12 col-sm-6">
|
||||||
<app-user-detail :name="name" @nameWasReset="name = $event"></app-user-detail>
|
<app-user-detail
|
||||||
|
:name="name"
|
||||||
|
@nameWasReset="name = $event"
|
||||||
|
:resetFn="resetName"
|
||||||
|
></app-user-detail>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-6">
|
<div class="col-xs-12 col-sm-6">
|
||||||
<app-user-edit></app-user-edit>
|
<app-user-edit></app-user-edit>
|
||||||
@ -29,6 +33,9 @@
|
|||||||
changeName(){
|
changeName(){
|
||||||
this.name = "TyrelSouza"
|
this.name = "TyrelSouza"
|
||||||
},
|
},
|
||||||
|
resetName(){
|
||||||
|
this.name = 'Tyrel';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
appUserDetail: UserDetail,
|
appUserDetail: UserDetail,
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
<div class="component">
|
<div class="component">
|
||||||
<h3>You may view the User Details here</h3>
|
<h3>You may view the User Details here</h3>
|
||||||
<p>Many Details</p>
|
<p>Many Details</p>
|
||||||
<p>User Name: {{ name }}</p>
|
<p>User Name: {{ switchName() }}</p>
|
||||||
<button @click="resetName">Reset Name</button>
|
<button @click="resetName">Reset Name</button>
|
||||||
|
<button @click="resetFn()">Reset Name Fn</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -12,9 +13,15 @@
|
|||||||
props: {
|
props: {
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
|
},
|
||||||
|
resetFn: {
|
||||||
|
type: Function
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
switchName(){
|
||||||
|
return this.name.split("").reverse().join("");
|
||||||
|
},
|
||||||
resetName(){
|
resetName(){
|
||||||
this.name = 'Tyrel';
|
this.name = 'Tyrel';
|
||||||
this.$emit('nameWasReset', this.name)
|
this.$emit('nameWasReset', this.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user