小编Suk*_*der的帖子

如何在vue.js自定义指令中传递动态参数

<template>
    <div>
        <img v-directive:dynamic_literal />
    </div>
</template>
Run Code Online (Sandbox Code Playgroud)

例如dynamic_literal ='ok'这样在自定义指令中:

Vue.directive('directive', {
    bind(el, binding) {  binding.arg  // should return 'ok'
Run Code Online (Sandbox Code Playgroud)

如何将dynamic_literal用作变量或常量,其值应在data或prop下分配。

我尝试使用v-directive:{{dynamic_literal}}和:v-directive =“ dynamic_literal”,但没有用。

提前致谢!

vue.js vue-component

5
推荐指数
2
解决办法
6323
查看次数

标签 统计

vue-component ×1

vue.js ×1