jquery.valert.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * Vue-jQuery-Amaze AlertMessage插件
  3. *
  4. * author
  5. * 2015-12-14
  6. */
  7. ;(function($) {
  8. $.extend({
  9. valert: function(string) {
  10. if (typeof(v_alert) == 'undefined') {
  11. var _html = '<div id="valert" class="am-modal am-modal-alert" tabindex="-1">';
  12. _html += '<div class="am-modal-dialog">';
  13. _html += '<div class="am-modal-hd">{{message}}</div>';
  14. _html += '<div class="am-modal-bd"></div>';
  15. _html += '<div class="am-modal-footer">';
  16. _html += '<span class="am-modal-btn">确定</span>';
  17. _html += '</div</div></div>';
  18. $('body').append(_html);
  19. jq_valert = $('#valert');
  20. v_alert = new Vue({
  21. el: '#valert',
  22. data: {
  23. message: 'Unknow'
  24. }
  25. });
  26. }
  27. v_alert.message = string;
  28. jq_valert.modal();
  29. }
  30. });
  31. })(jQuery);