Skip to content

Commit

Permalink
Clear fields using Vue.delete() to trigger view updates.
Browse files Browse the repository at this point in the history
- Fix issue #2
  • Loading branch information
sahibalejandro committed Sep 28, 2017
1 parent b04a527 commit 0606343
Show file tree
Hide file tree
Showing 4 changed files with 351 additions and 381 deletions.
20 changes: 13 additions & 7 deletions dist/errors.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
"use strict";
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _vue = require('vue');

var _vue2 = _interopRequireDefault(_vue);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

module.exports = function () {
Expand All @@ -25,7 +31,7 @@ module.exports = function () {


_createClass(_class, [{
key: "set",
key: 'set',
value: function set(errors) {
this.errors = errors;
}
Expand All @@ -38,7 +44,7 @@ module.exports = function () {
*/

}, {
key: "has",
key: 'has',
value: function has(field) {
return this.errors.hasOwnProperty(field);
}
Expand All @@ -51,7 +57,7 @@ module.exports = function () {
*/

}, {
key: "get",
key: 'get',
value: function get(field) {
if (this.has(field)) {
return this.errors[field][0];
Expand All @@ -66,7 +72,7 @@ module.exports = function () {
*/

}, {
key: "getAll",
key: 'getAll',
value: function getAll(field) {
if (this.has(field)) {
return this.errors[field];
Expand All @@ -81,10 +87,10 @@ module.exports = function () {
*/

}, {
key: "clear",
key: 'clear',
value: function clear(field) {
if (field) {
delete this.errors[field];
_vue2.default.delete(this.errors, field);
} else {
this.errors = {};
}
Expand Down
Loading

0 comments on commit 0606343

Please sign in to comment.