Skip to content

Plugin arguments #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2014
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion source/api/global-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ Vue.js batches view updates and execute them all asynchronously. It uses `reques

Get access to Vue.js' internal modules. This is intended for plugin authors only.

### Vue.use( plguin )
### Vue.use( plugin, [args...] )

- **plugin** `Object` or `Function`
- **args...** *optional*

Mount a Vue.js plugin. If the plugin is an Object, it must have an `install` method. If it is a function itself, it will be treated as the install method. The install method will be called with Vue as the argument. For more details, see [Plugins](/guide/plugin.html).
9 changes: 8 additions & 1 deletion source/guide/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ Vue.use(vueTouch)
Vue.use('vue-touch')
```

### Optional arguments

```js
// every additional argument will be passed to the plugin
Vue.use('vue-touch', { moveTolerance: 12 })
```

## Plugin Implementation

``` js
exports.install = function (Vue) {
exports.install = function (Vue, options) {
// use Vue.require to access internal modules
var utils = Vue.require('utils')
}
Expand Down