feat(utils): 为消息提示组件添加持续时间配置选项
- 为 KitMessage.js 中的 Info、Success、Warning 和 Error 方法添加 duration 参数,默认值为 3000ms - 在 KitMessage.js 中当 duration 小于等于 0 时显示关闭按钮 - 为 KitNotification.js 中的 Info、Success、Warning 和 Error 方法添加 duration 参数,默认值为 3000ms - 移除 WebSocketDemo.vue 组件文件 - 修改 CuteButton.vue 组件将默认类型从 primary 改为 normal,并重构内部类型计算逻辑 - 为 CuteLink.vue 组件添加 disabled 属性支持
This commit is contained in:
@@ -3,24 +3,36 @@ import Vue from 'vue'
|
||||
* 消息提示
|
||||
*/
|
||||
export default {
|
||||
Info: function(content) {
|
||||
Info: function(content, duration = 3000) {
|
||||
Vue.prototype.$message({
|
||||
message: content, type: 'info'
|
||||
message: content,
|
||||
type: 'info',
|
||||
duration: duration,
|
||||
showClose: duration <= 0
|
||||
})
|
||||
},
|
||||
Success: function(content) {
|
||||
Success: function(content, duration = 3000) {
|
||||
Vue.prototype.$message({
|
||||
message: content, type: 'success'
|
||||
message: content,
|
||||
type: 'success',
|
||||
duration: duration,
|
||||
showClose: duration <= 0
|
||||
})
|
||||
},
|
||||
Warning: function(content) {
|
||||
Warning: function(content, duration = 3000) {
|
||||
Vue.prototype.$message({
|
||||
message: content, type: 'warning'
|
||||
message: content,
|
||||
type: 'warning',
|
||||
duration: duration,
|
||||
showClose: duration <= 0
|
||||
})
|
||||
},
|
||||
Error: function(content) {
|
||||
Error: function(content, duration = 3000) {
|
||||
Vue.prototype.$message({
|
||||
message: content, type: 'error'
|
||||
message: content,
|
||||
type: 'error',
|
||||
duration: duration,
|
||||
showClose: duration <= 0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,29 @@ import Vue from 'vue'
|
||||
* 通知
|
||||
*/
|
||||
export default {
|
||||
Info: function(content) {
|
||||
Vue.prototype.$notify({ message: content, type: 'info' })
|
||||
}, Success: function(content) {
|
||||
Vue.prototype.$notify({ message: content, type: 'success' })
|
||||
}, SuccessDuration: function(content, durationTime) {
|
||||
Vue.prototype.$notify({ message: content, type: 'success', duration: durationTime })
|
||||
}, Warning: function(content) {
|
||||
Vue.prototype.$notify({ message: content, type: 'warning' })
|
||||
}, Error: function(content) {
|
||||
Vue.prototype.$notify({ message: content, type: 'error' })
|
||||
}, ErrorDuration: function(content, durationTime) {
|
||||
Vue.prototype.$notify({ message: content, type: 'error', duration: durationTime })
|
||||
Info: function(content, duration = 3000) {
|
||||
Vue.prototype.$notify({
|
||||
message: content,
|
||||
type: 'info',
|
||||
duration: duration
|
||||
})
|
||||
}, Success: function(content, duration = 3000) {
|
||||
Vue.prototype.$notify({
|
||||
message: content,
|
||||
type: 'success',
|
||||
duration: duration
|
||||
})
|
||||
}, Warning: function(content, duration = 3000) {
|
||||
Vue.prototype.$notify({
|
||||
message: content,
|
||||
type: 'warning',
|
||||
duration: duration
|
||||
})
|
||||
}, Error: function(content, duration = 3000) {
|
||||
Vue.prototype.$notify({
|
||||
message: content,
|
||||
type: 'error',
|
||||
duration: duration
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user