msg.js 692 B

12345678910111213141516171819202122232425262728293031323334
  1. function msg(Vue) {
  2. Vue.prototype.$msg = function(text, type, bc, bc2, isHtml) {
  3. if (type === 'confirm') {
  4. this.$confirm(text, '提示', {
  5. type: 'warning',
  6. dangerouslyUseHTMLString: isHtml
  7. }).then(() => {
  8. if (bc) bc()
  9. }).catch(() => {
  10. if (bc2) bc2()
  11. })
  12. } else {
  13. this.$alert(text, '提示', {
  14. callback: action => {
  15. if (bc) bc()
  16. }
  17. })
  18. }
  19. }
  20. Vue.prototype.$msgs = function(message) {
  21. this.$message({
  22. message,
  23. type: 'success'
  24. })
  25. }
  26. Vue.prototype.$msgw = function(message) {
  27. this.$message({
  28. message,
  29. type: 'warning'
  30. })
  31. }
  32. }
  33. export default msg