You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm editing existing values using $prompt and want to support empty values as well. Due to the current implementation, I get an error when the user wants to remove the existing value.
In this case I cannot distinguish between an error or just an empty value.
To workaround this, l I've copied the $prompt method and added a modified version to my project.
This is the code I use:
import Vue from "vue";
import VueSimpleAlert from "vue-simple-alert";
import Swal from "sweetalert2";
Vue.prototype.$prompt = function (message, defaultText, title, type, options) {
return new Promise(function (resolve, reject) {
var mixedOptions = Object.assign(Object.assign({}, VueSimpleAlert.globalOptions), options);
mixedOptions.title = title || mixedOptions.title;
mixedOptions.inputValue = defaultText;
mixedOptions.html = message || mixedOptions.text;
mixedOptions.type = type || mixedOptions.type;
mixedOptions.showCancelButton = true;
mixedOptions.input = mixedOptions.input || "text";
Swal.fire(mixedOptions)
.then(function (r) {
resolve(r.value);
})
.catch(function (e) {
console.log("Error $trompt", e);
return reject();
});
});
};
vue-simple-alert/src/index.ts
Line 84 in cc0eaa5
must be
if ('value' in r) {
The text was updated successfully, but these errors were encountered: