Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147542 | Sep 15,2019 03:40 PM UTC | Oct 3,2019 05:23 AM UTC | Vue | 13 |
![]() |
Tags: Toast |
this.$refs.layout.$refs.toastRef.show();
|
<template>
<div>
<AppMain @appMainClicked="showToast"/>
<ejs-toast
ref="toastRef"
title="Matt sent you a friend request"
content="Hey, wanna dress up as wizards and ride our hoverboards?"
></ejs-toast>
</div>
</template>
<script>
export default {
name: "Layout",
methods: {
showToast() {
this.$refs.toastRef.show();
}
}
};
</script> |
<template>
<div>
AppMain
<button v-on:click="onClick">Show Toast in child component</button>
</div>
</template>
<script>
export default {
name: "AppMain",
methods: {
onClick: function() {
this.$emit('appMainClicked', '');
}
}
};
</script> |
<template>
<div>
Load
<button v-on:click="onClick">Show Toast from Load component</button>
</div>
</template>
<script>
export default {
name: "Load",
methods: {
onClick: function () {
this.$emit('loadClicked', '');
}
}
};
</script>
|
<template>
<div>
AppMain
<button v-on:click="onClick">Show Toast from AppMain component</button>
<Load @loadClicked="onClick" />
</div>
</template>
<script>
import Load from "./Load";
export default {
name: "AppMain",
components: {
Load
},
methods: {
onClick: function () {
this.$emit('appMainClicked', '');
}
}
};
</script>
|
<template>
<div class="app-main">
<br>AppMain
<br>
<br>
<router-link class="link" :to="{ path: '/load', query: { name: 'Foo' }}">Load</router-link>
<br>
<br>
<router-link class="link" :to="{ path: '/alive', query: { name: 'Foo' }}">KeepAlive</router-link>
<br>
<br>
<router-view @loadClicked="onClick"/>
</div>
</template>
<script>
export default {
name: "AppMain",
methods: {
onClick: function() {
this.$emit("appMainClicked", "");
}
}
};
</script>
|
<template>
<div class="load">
Load
<button v-on:click="onClick">Show Toast from Load component</button>
</div>
</template>
<script>
export default {
name: "Load",
methods: {
onClick: function() {
this.$emit("loadClicked", "");
}
}
};
</script>
|
<style>
.e-toast {
z-index: 1007 !important;
}
</style> |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.