是否可以为单个节点设置多个装饰器?

Is it possible to set multiple decorators for a single node?

类似

<button decorator='initbutton:p1, p2; tooltip:Text' />

我找到了一个用于组合装饰器的装饰器助手插件:
http://martypdx.github.io/ractive-decorators-helpers/
这是目前最好的选择吗?

Ractive 本身不支持多个装饰器,至少现在不支持。您找到的 decorator helper plugin 是目前最好的选择。

有人 opened an issue on GitHub 请求此功能,如果你想插话。

使用ractive-multi-decorator

首先安装它:

npm install ractive-multi-decorator --save

然后添加到ractive:

var ractive = new Ractive({
    ...
    decorators: {
        multi: require('ractive-multi-decorator')
    },
    ...
});

然后使用它:

<div 
    id="myelement"
    decorator="multi:{ 
        localdecorator: [ {{ dynamicArg1 }}, arg2, arg3 ], 
        globaldecorator: {{singleArg}}, 
        anotherdecorator: true 
    }"
></div>

感谢 akhouzy 和 martypdx。