After reading the relevant information, I found that priority needs to be set when registering the command. The larger the value, the higher the priority.
html
<p id="app">
<span v-a="'abc'" v-b="'efg'"></span>
</p>
js
Vue.directive('a', {
priority: 990,
bind: function () {
alert('a')
}
})
Vue.directive('b', {
priority: 1000,
bind: function () {
alert('b')
}
})
new Vue({
el: "#app"
})
Expected effect
Execute alert('b') first, then alert('a');
Actual effect
Execute alert('a') first, then alert('b');
Please tell me how to set it up so that the 'v-b' command can be executed first and then the 'v-a' command
---------Separating line----------
Knownpriority
is abandoned, then does it represent the execution of two customized instructions? The order can only be executed in the order of front and back?
漂亮男人2017-07-05 10:56:52
In Vue2, the priority attribute in custom directives has been abandoned
For details, see: https://cn.vuejs.org/v2/guide... Custom directives - simplified