You have several ways to do this.
Edit: Improved 2)
You can use the v-model, as in 2), but instead of using the value directly in your orderBy filter, you can use calculated properties
computed: { sortKey: { get: function() { return this.sorting.split(' ')[0];
Thus, sortKey and sortOrder will be available as a regular property in your filter:
v-repeat="items | orderBy sortKey sortOrder"
1) Use the JavaScript event:
If you do not specify any parameter, your own event object will be transferred automatically
<select class="sort-filter" v-on:change="sortBy">
Then you can use it like this:
methods: { sortBy: function(e) { console.log(e.target.value); }, }
2) Using the v-model
You can add v-model directive
<select name="test" v-model="sorting" v-on:change="sortBy">
Thus, the sorting value will be updated with every change.
You can add this value to the data object of your ViewModel to be more clear:
data: { sorting: null // Will be updated when the select value change }
Then you can access the value, as in your method:
methods: { sortBy: function() { console.log(this.sorting); }, }
If you just need to update the sortKey value, this method is not even needed.
3) Another weird way
Obviously, you can use the value of your model as a parameter.
<select name="test" v-model="sortKey" v-on:change="sortBy(sortKey)">
It works, but I don't see the point.
methods: { sortBy: function(sortKey) { console.log(sortKey); }, }