when using el-dropdown
of https://element.eleme.io/#/en-US/component/dropdown, how do I trigger the dropdown or hide it with code, when split-button
is true
? I can do it easily when I was using React
and bootstrap
with ref
or bootstrap control
CodePudding user response:
You can achieve that by adding a ref
to el-dropdown
element.
<el-dropdown ref="dropdownElement" split-button type="primary" @click="handleClick">
Then, In the handleClick()
method you can access the split-button
flag true
/false
and then do the code as per your requirement.
if (this.$refs.dropdownElement.splitButton) {
// write your code here
}