Comparing version 0.0.10 to 0.0.12
{ | ||
"name": "vuedl", | ||
"version": "0.0.10", | ||
"version": "0.0.12", | ||
"description": "Vue dialog helper", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -46,7 +46,7 @@ # Vuedl - vue dialog helper | ||
### Register anduse global dialog | ||
### Register and use dialog components | ||
Register global dialog component, which will be available in any vue module | ||
Register global dialog component, then it will be available in any vue module | ||
```javascript | ||
Vue.prototype.$dialog.register('myDialog', MyDialog) | ||
Vue.prototype.$dialog.component('myDialog', MyDialog) | ||
``` | ||
@@ -53,0 +53,0 @@ Then you can use it in any code |
@@ -18,3 +18,4 @@ import Returnable from './returnable' | ||
default: () => [] | ||
} | ||
}, | ||
params: Object | ||
}, | ||
@@ -28,7 +29,6 @@ | ||
if (typeof action === 'string') { | ||
action = {text: action} | ||
action = { text: action } | ||
} | ||
this.$set(action, 'loading', false) | ||
if (!action.key) { | ||
action.key = isNaN(key) ? key : action.text | ||
action.key = isNaN(key) ? key : (action.text || key) | ||
} | ||
@@ -67,20 +67,20 @@ if (['true', 'false'].indexOf(action.key) >= 0) { | ||
}, | ||
isActionDisabled (action) { | ||
if (action.disabled === undefined) { | ||
return false | ||
get (param, def) { | ||
if (param === undefined) { | ||
return def | ||
} | ||
if (typeof action.disabled === 'function') { | ||
return action.disabled() | ||
if (typeof param === 'function') { | ||
return param(this.params) | ||
} | ||
return action.disabled | ||
return param | ||
}, | ||
isActionDisabled (action) { | ||
return this.get(action.disabled, false) | ||
}, | ||
isActionVisible (action) { | ||
if (action.visible === undefined) { | ||
return true | ||
} | ||
if (typeof action.visible === 'function') { | ||
return action.visible() | ||
} | ||
return action.visible | ||
return this.get(action.visible, true) | ||
}, | ||
isActionInLoading (action) { | ||
return this.loadingAction === action.key || this.get(action.loading) | ||
}, | ||
async onActionClick (action) { | ||
@@ -92,3 +92,3 @@ const closable = action.closable === undefined || action.closable === true | ||
try { | ||
let ret = await action.handle() | ||
let ret = await action.handle(this.params) | ||
this.setLoadingState(false) | ||
@@ -95,0 +95,0 @@ if (ret !== false && closable) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
697408