<div v-demo=”color: ‘white’, text: ‘hello'”></div>
如果指令需要多个值,可以传入一个JavaScript对象字面量。如:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>
<div id="hook-arguments-example" v-demo-directive="{ color: 'white', text: 'hello!' }"></div>
<script>
Vue.directive('demoDirective', function(el, binding, vnode){
console.log(binding.value.color);
console.log(binding.value.text);
});
var demo = new Vue({
el: '#hook-arguments-example'
})
</script>
</body>
</html>
运行截图:

字面指令
若在创建自定义指令时,设置isLiterral: true,则特性值被视作字符串,并赋给该指令的expression,字面指令不会建立数据监视。
参考链接
Vue.js教程 (2) : 指令 Directives
Vue.JS入门篇–自定义指令
vue.js笔记——指令










