You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
718B

  1. var appAlerts = new Vue({
  2. el: '#app-alerts',
  3. data: {
  4. alerts: [
  5. ]
  6. },
  7. mounted: function() {
  8. },
  9. methods: {
  10. alert: function(type, message) {
  11. var app = this ;
  12. var index = this.alerts.length ;
  13. this.alerts.splice(index, 0, {
  14. display: false,
  15. type: type,
  16. message: message
  17. });
  18. var functionDisplayAlert = function(app, index, display) {
  19. app.alerts[index].display = display ;
  20. } ;
  21. setTimeout(functionDisplayAlert, 500, app, index, true) ;
  22. setTimeout(functionDisplayAlert, 3000, app, index, false) ;
  23. }
  24. }
  25. });