Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/v2/guide/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,28 @@ A Vue.js plugin should expose an `install` method. The method will be called wit
MyPlugin.install = function (Vue, options) {
// 1. add global method or property
Vue.myGlobalMethod = function () {
// something logic ...
// some logic ...
}

// 2. add a global asset
Vue.directive('my-directive', {
bind (el, binding, vnode, oldVnode) {
// something logic ...
// some logic ...
}
...
})

// 3. inject some component options
Vue.mixin({
created: function () {
// something logic ...
// some logic ...
}
...
})

// 4. add an instance method
Vue.prototype.$myMethod = function (methodOptions) {
// something logic ...
// some logic ...
}
}
```