|
[Combobocomponent.vue]
<template>
<div>
<combo></combo>
</div>
</template>
<script>
import Vue from "vue";
import { ComboBoxPlugin } from "@syncfusion/ej2-vue-dropdowns";
import { Query } from "@syncfusion/ej2-data";
Vue.use(ComboBoxPlugin);
Vue.component("combo", {
template:
"<div><ejs-combobox :allowCustom='allowCustom' :floatLabelType='floatLabelType' :popupHeight='popupHeight' :allowFiltering='allowFiltering' v-bind:placeholder='waterMark' v-bind:dataSource='data'></ejs-combobox></div>",
data() {
return {
allowCustom:true,
allowFiltering:true,
popupHeight:"250px",
floatLabelType:"Auto",
waterMark: "Choose value",
data:['Badminton', 'Cricket', 'Football', 'Golf', 'Tennis'],
labelType: "Auto",
};
},
});
export default {
name: "SfComboBox",
props: {
msg: String,
},
};
</script>
|
|
[App.vue]
<template>
<div>
<SfComboBox />
<SfComboBox />
<SfComboBox />
<SfComboBox />
</div>
</template>
<script>
import Vue from "vue";
import SfComboBox from "./components/Comboboxcomponent";
export default Vue.extend({
components: {
SfComboBox,
},
data: function () {
return {};
},
});
</script> |
|
[ComboboxComponent.vue]
<template>
<div>
<div><ejs-combobox :allowCustom='allowCustom' v-model='modelvalue' :floatLabelType='floatLabelType' :popupHeight='popupHeight' :allowFiltering='allowFiltering' :placeholder='message' v-bind:dataSource='datavalue'></ejs-combobox></div>
</div>
</template>
<script>
import Vue from "vue";
import { ComboBoxPlugin } from "@syncfusion/ej2-vue-dropdowns";
Vue.use(ComboBoxPlugin);
export default Vue.extend({
name: "SfComboBox",
props: ['message','datavalue','modelvalue'],
data: function () {
return {
allowCustom:true,
allowFiltering:true,
popupHeight:"250px",
floatLabelType:"Auto",
labelType: "Auto",
};
},
});
</script> |
|
[App.vue]
<template>
<div>
<div class="control-section">
<div
id="content"
style="margin: 0px auto; width: 300px; padding-top: 40px"
>
<SfComboBox :message="message" :modelvalue="modelvalue" :datavalue="datavalue"/>
<SfComboBox :message="message" :modelvalue="modelvalue" :datavalue="datavalue"/>
<SfComboBox :message="message" :modelvalue="modelvalue" :datavalue="datavalue"/>
<SfComboBox :message="message" :modelvalue="modelvalue" :datavalue="datavalue"/>
</div>
</div>
</div>
</template>
<script>
import Vue from "vue";
import SfComboBox from "./components/Comboboxcomponent";
export default Vue.extend({
components: {
SfComboBox,
},
data: function () {
return {
message: 'DATA FROM PARENT!',
modelvalue:"Badminton",
datavalue:['Badminton', 'Cricket', 'Football', 'Golf', 'Tennis'],
};
},
});
</script> |
Hallo Berly,
I have same question with the creator threads, and i follow your code in combobox, and i got this eror, i'm try using v-bind:value, but the value not change, any solution for that?
sorry for my bad english, thank you.