Skip to content

Commit 3ca627e

Browse files
committed
Replace indexOf checks with new component match helper
1 parent 2f6697c commit 3ca627e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/vfjs-field-mixin/computed.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ const computed = {
2020
// id: this.vfjsFieldId, // This is very useful when debugging to see when nodes are updated
2121
};
2222

23-
const { required = [], value = [] } = this.vfjsOptions.componentProperties.attrs;
23+
const { checked = [], required = [], value = [] } = this.vfjsOptions.componentProperties.attrs;
2424

25-
if (required.indexOf(this.vfjsComponent) !== -1) {
25+
if (this.vfjsFieldHelperComponentMatchesComponentProperties(required)) {
2626
attrs.required = this.vfjsFieldRequired;
2727
}
2828

29-
if (value.indexOf(this.vfjsComponent) !== -1) {
29+
if (this.vfjsFieldHelperComponentMatchesComponentProperties(value)) {
3030
attrs.value = this.vfjsFieldModel || (this.vfjsFieldOptions.attrs && this.vfjsFieldOptions.attrs.value);
3131
}
3232

@@ -37,19 +37,19 @@ const computed = {
3737

3838
const { innerHTML = [] } = this.vfjsOptions.componentProperties;
3939

40-
if (innerHTML.indexOf(this.vfjsComponent) !== -1) {
40+
if (this.vfjsFieldHelperComponentMatchesComponentProperties(innerHTML)) {
4141
domProps.innerHTML = this.vfjsFieldModel
4242
|| (this.vfjsFieldOptions.domProps && this.vfjsFieldOptions.domProps.innerHTML);
4343
}
4444

4545
const { checked, value } = this.vfjsOptions.componentProperties.domProps;
4646

47-
if (value.indexOf(this.vfjsComponent) !== -1) {
47+
if (this.vfjsFieldHelperComponentMatchesComponentProperties(value)) {
4848
domProps.value = this.vfjsFieldModel
4949
|| (this.vfjsFieldOptions.domProps && this.vfjsFieldOptions.domProps.value);
5050
}
5151

52-
if (checked.indexOf(this.vfjsComponent) !== -1) {
52+
if (this.vfjsFieldHelperComponentMatchesComponentProperties(checked)) {
5353
domProps.checked = this.vfjsFieldModel
5454
|| (this.vfjsFieldOptions.domProps && this.vfjsFieldOptions.domProps.checked);
5555
}

0 commit comments

Comments
 (0)