Guest User

Untitled

a guest
Jan 16th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <script>
  2. import set_interceptors from "./plugins/popups.js"
  3. export default {
  4. name: 'AppInterface',
  5. data: () => ({
  6. popup: {},
  7. popup_queue: []
  8. }),
  9. watch: {
  10. popup_queue: function(val) {
  11. if(val.length>0) {
  12. this.popup = val[0]
  13. if (!this.popup.timeout) {
  14. this.popup.timeout = setTimeout(function(){
  15. val.shift()
  16. }, 6000)
  17. }
  18. }
  19. }
  20. },
  21. created() {
  22. set_interceptors(this.popup_queue); // устанавливает перехватчик на axios, уже работает
  23. },
  24. }
  25. </script>
  26.  
  27. <v- .... @click="$popup_queue.push({message:'test'})" >
  28.  
  29. created() {
  30. this.$root.popup_queue = this.popup_queue;
  31. set_interceptors(this.popup_queue);
  32. },
Add Comment
Please, Sign In to add comment