Vue.js Mixins Custom Option Merge Strategies

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

When custom options are merged, they use the default strategy, which simply overwrites the existing value. If you want a custom option to be merged using custom logic, you need to attach a function to Vue.config.optionMergeStrategies:

Vue.config.optionMergeStrategies.myOption = function (toVal, fromVal) {
  // return mergedVal
}

For most object-based options, you can simply use the same strategy used by methods:

var strategies = Vue.config.optionMergeStrategies
strategies.myOption = strategies.methods


Got any Vue.js Question?