|
37 | 37 | )
|
38 | 38 | </template>
|
39 | 39 | <script>
|
40 |
| -/*global Vue:true*/ |
41 |
| -import abstractField from "./abstractField"; |
| 40 | + import Vue from "vue"; |
| 41 | + import abstractField from "./abstractField"; |
42 | 42 |
|
43 |
| -export default { |
44 |
| - mixins: [abstractField], |
45 |
| - computed: { |
46 |
| - options() { |
47 |
| - let values = this.schema.values; |
48 |
| - if (typeof(values) == "function") { |
49 |
| - return values.apply(this, [this.model, this.schema]); |
50 |
| - } else { |
51 |
| - return values; |
| 43 | + export default { |
| 44 | + mixins: [abstractField], |
| 45 | + computed: { |
| 46 | + options() { |
| 47 | + let values = this.schema.values; |
| 48 | + if (typeof(values) == "function") { |
| 49 | + return values.apply(this, [this.model, this.schema]); |
| 50 | + } else { |
| 51 | + return values; |
| 52 | + } |
52 | 53 | }
|
53 |
| - } |
54 |
| - }, |
55 |
| - methods: { |
56 |
| - updateSelected(value/*, id*/) { |
57 |
| - this.value = value; |
58 | 54 | },
|
59 |
| - addTag(newTag, id) { |
60 |
| - let onNewTag = this.schema.selectOptions.onNewTag; |
61 |
| - if (typeof(onNewTag) == "function") { |
62 |
| - onNewTag(newTag, id, this.options, this.value); |
| 55 | + methods: { |
| 56 | + updateSelected(value/*, id*/) { |
| 57 | + this.value = value; |
| 58 | + }, |
| 59 | + addTag(newTag, id) { |
| 60 | + let onNewTag = this.schema.selectOptions.onNewTag; |
| 61 | + if (typeof(onNewTag) == "function") { |
| 62 | + onNewTag(newTag, id, this.options, this.value); |
| 63 | + } |
| 64 | + }, |
| 65 | + onSearchChange(searchQuery, id) { |
| 66 | + let onSearch = this.schema.selectOptions.onSearch; |
| 67 | + if (typeof(onSearch) == "function") { |
| 68 | + onSearch(searchQuery, id, this.options); |
| 69 | + } |
| 70 | + }, |
| 71 | + onSelect(/*selectedOption, id*/) { |
| 72 | + // console.log("onSelect", selectedOption, id); |
| 73 | + }, |
| 74 | + onRemove(/*removedOption, id*/) { |
| 75 | + // console.log("onRemove", removedOption, id); |
| 76 | + }, |
| 77 | + onOpen(/*id*/) { |
| 78 | + // console.log("onOpen", id); |
| 79 | + }, |
| 80 | + onClose(/*value, id*/) { |
| 81 | + // console.log("onClose", value, id); |
63 | 82 | }
|
64 | 83 | },
|
65 |
| - onSearchChange(searchQuery, id) { |
66 |
| - let onSearch = this.schema.selectOptions.onSearch; |
67 |
| - if (typeof(onSearch) == "function") { |
68 |
| - onSearch(searchQuery, id, this.options); |
| 84 | + created() { |
| 85 | + // Check if the component is loaded |
| 86 | + if (window.VueMultiselect) { |
| 87 | + Vue.component("multiselect", window.VueMultiselect.default); |
| 88 | + } else { |
| 89 | + console.error("'vue-multiselect' is missing. Please download from https://github.com/monterail/vue-multiselect and load the script in the HTML head section!"); |
69 | 90 | }
|
70 |
| - }, |
71 |
| - onSelect(/*selectedOption, id*/) { |
72 |
| - // console.log("onSelect", selectedOption, id); |
73 |
| - }, |
74 |
| - onRemove(/*removedOption, id*/) { |
75 |
| - // console.log("onRemove", removedOption, id); |
76 |
| - }, |
77 |
| - onOpen(/*id*/) { |
78 |
| - // console.log("onOpen", id); |
79 |
| - }, |
80 |
| - onClose(/*value, id*/) { |
81 |
| - // console.log("onClose", value, id); |
82 |
| - } |
83 |
| - }, |
84 |
| - created() { |
85 |
| - // Check if the component is loaded |
86 |
| - if (window.VueMultiselect) { |
87 |
| - Vue.component("multiselect", window.VueMultiselect.default); |
88 |
| - } else { |
89 |
| - console.error("'vue-multiselect' is missing. Please download from https://github.com/monterail/vue-multiselect and load the script in the HTML head section!"); |
90 | 91 | }
|
91 |
| - } |
92 |
| -}; |
| 92 | + }; |
93 | 93 | </script>
|
94 | 94 |
|
0 commit comments