Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit aed5bad

Browse files
committed
filter fields based on values (property "show")
1 parent c6b98ce commit aed5bad

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

dist/vue-form.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ return /******/ (function(modules) { // webpackBootstrap
249249
}
250250

251251
if (_.isString(field.name)) {
252-
flds.push(field);
252+
if (!field.show || (new Vue({data: this.values})).$eval(field.show)) {
253+
flds.push(field);
254+
}
253255
} else {
254256
_.warn('Field name missing ' + JSON.stringify(field));
255257
}

dist/vue-form.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/fields.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ module.exports = function (_, Vue) {
9494
}
9595

9696
if (_.isString(field.name)) {
97-
flds.push(field);
97+
if (!field.show || (new Vue({data: this.values})).$eval(field.show)) {
98+
flds.push(field);
99+
}
98100
} else {
99101
_.warn('Field name missing ' + JSON.stringify(field));
100102
}

0 commit comments

Comments
 (0)