Vue.js Mixins Custom Option Merge Strategies


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