From f0e5010c3ac3c6a7423edb902a425eea4d0c1c97 Mon Sep 17 00:00:00 2001 From: Pierre Bertet Date: Thu, 20 Feb 2014 18:10:18 +0000 Subject: [PATCH] Plugin arguments --- source/api/global-methods.md | 3 ++- source/guide/plugin.md | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source/api/global-methods.md b/source/api/global-methods.md index 4a078f27ab..af1e322e7d 100644 --- a/source/api/global-methods.md +++ b/source/api/global-methods.md @@ -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). \ No newline at end of file diff --git a/source/guide/plugin.md b/source/guide/plugin.md index a07d30ce4f..60b0fb123d 100644 --- a/source/guide/plugin.md +++ b/source/guide/plugin.md @@ -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') }