<code>
<style>
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
</style>
<template>
<div class="control_wrapper" style="margin:50px auto 0; width:250px;">
<ejs-dropdownlist id='dropdownlist' :dataSource='sportsData' :created='test'></ejs-dropdownlist>
</div>
</template>
<script>
import Vue from 'vue';
import { DropDownListPlugin } from "@syncfusion/ej2-vue-dropdowns";
Vue.use(DropDownListPlugin);
export default Vue.extend({
data: function() {
return {
sportsData: ['Badminton', 'Cricket', 'Football', 'Golf', 'Tennis'],
state: true
}
},
methods: {
test: function(e){
var ddlClasses = document.getElementById('dropdownlist').ej2_instances[0];
ddlClasses.cssClass = (this.state) ? 'e-success' : 'e-error';
}
}
});
</script>
</code> |
<code>
test: function(e){
var ddlClasses = document.getElementById('dropdownlist').ej2_instances[0].element.parentElement.classList;
if(status){
ddlClasses.remove('e-error');
ddlClasses.add('e-success');
}
else {
ddlClasses.add('e-error');
ddlClasses.remove('e-success');
}
}
</code> |