Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- import set_interceptors from "./plugins/popups.js"
- export default {
- name: 'AppInterface',
- data: () => ({
- popup: {},
- popup_queue: []
- }),
- watch: {
- popup_queue: function(val) {
- if(val.length>0) {
- this.popup = val[0]
- if (!this.popup.timeout) {
- this.popup.timeout = setTimeout(function(){
- val.shift()
- }, 6000)
- }
- }
- }
- },
- created() {
- set_interceptors(this.popup_queue); // устанавливает перехватчик на axios, уже работает
- },
- }
- </script>
- <v- .... @click="$popup_queue.push({message:'test'})" >
- ....
- const bus = new Vue();
- Vue.prototype.$bus = bus;
- ...
- this.$bus.$emit("test", this.popup_queue);
- this.$bus.$on("test", this.handler);
Add Comment
Please, Sign In to add comment