diff --git a/source/guide/custom-directive.md b/source/guide/custom-directive.md index 7bc86be178..edb150cc58 100644 --- a/source/guide/custom-directive.md +++ b/source/guide/custom-directive.md @@ -111,6 +111,26 @@ var demo = new Vue({ }) +### Multiple Clauses + +Comma separated arguments are bound as multiple directive instances. In the following example, directive methods are called twice: + +``` html +
+``` + +You can achieve single binding with all arguments by closing value with object literal: + +``` html + +``` + +``` js +Vue.directive('demo', function (value) { + console.log(value) // Object {color: 'white', text: 'hello!'} +}) +``` + ## Literal Directives If you pass in `isLiteral: true` when creating a custom directive, the attribute value will be taken as a literal string and assigned as that directive's `expression`. The directive will not attempt to setup data observation.