From f5557bcd786393cd34ddf3e4090685e161725a16 Mon Sep 17 00:00:00 2001 From: Simone Todaro Date: Wed, 17 Jan 2018 22:08:35 +0000 Subject: [PATCH] Move console warning --- src/components/Select.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/Select.vue b/src/components/Select.vue index ae01e1a..c4285c8 100644 --- a/src/components/Select.vue +++ b/src/components/Select.vue @@ -527,6 +527,16 @@ 'http://sagalbot.github.io/vue-select/#ex-labels' ) } + + if(this.index) { + if (!option.hasOwnProperty(this.index)) { + console.warn( + `[vue-select warn]: Index key "option.${this.index}" does not` + + ` exist in options object ${JSON.stringify(option)}.` + ) + } + } + if (this.label && option[this.label]) { return option[this.label] } @@ -785,12 +795,6 @@ option = this.createOption(option) } if(this.index) { - if (!option.hasOwnProperty(this.index)) { - console.warn( - `[vue-select warn]: Index key "option.${this.index}" does not` + - ` exist in options object ${JSON.stringify(option)}.` - ) - } option = option[this.index] } if (this.multiple && !this.mutableValue) {