dabernathy89 / vue-query-builder

A UI component for building complex queries with nested conditionals.
https://dabernathy89.github.io/vue-query-builder/
MIT License
643 stars 157 forks source link

How to trigger the select box event #47

Closed fly-wind closed 4 years ago

fly-wind commented 5 years ago

I want to be able to listen for the change event in the drop-down box in the condition so that I can do different things. For example, I added a new condition, a compare >= b, when switching compare to not compare, there should be no other options later. How to monitor the event of the compare select box?

dabernathy89 commented 4 years ago

@fly-wind sorry that I couldn't back to you sooner on that.

I don't think there was a great way to do this before, but you can now try using the support for custom templates:

https://dabernathy89.github.io/vue-query-builder/custom-templates.html#setting-up-your-vue-instance

I don't have any examples yet of using this to provide custom logic, but it should be pretty straightforward. You will just want to take a look at how QueryBuilderGroup and QueryBuilderRule work under the hood:

https://github.com/dabernathy89/vue-query-builder/blob/master/src/components/QueryBuilderGroup.vue https://github.com/dabernathy89/vue-query-builder/blob/master/src/components/QueryBuilderRule.vue