common.js 713 B

12345678910111213141516171819202122232425
  1. export default{
  2. install(Vue){
  3. //这里是示例方法 getTime是方法名 function()可以携带参数
  4. Vue.prototype.getTime = function(val,fun,title){
  5. this.$confirm(val, '提示', {
  6. confirmButtonText: '确定',
  7. cancelButtonText: '取消',
  8. type: 'warning'
  9. }).then(() => {
  10. fun
  11. this.$message({
  12. type: 'success',
  13. message: title+'成功!'
  14. });
  15. }).catch(() => {
  16. this.$message({
  17. type: 'info',
  18. message: '已取消'+title
  19. });
  20. });
  21. }
  22. }
  23. }