requirement description:
the tree component of element-ui is used in the project, the content of each node needs to be customized, and the rendering function is used:
renderContent(h, { node, data, store }) {
if(node.data.templateItem){
return (
<span class="custom-tree-node">
<span class="custom-icon icon-file"></span>
<span>{node.data.name}</span>
</span>
)
}else{
if(node.data.mode==="CYCLE"){
return (
<span class="custom-tree-node">
<span class="custom-icon icon-clock"></span>
<span>{node.data.name}</span>
</span>
)
}else if(node.data.mode==="ONCE"){
return (
<span class="custom-tree-node">
<span class="custom-icon icon-bookmark"></span>
<span>{node.data.name}</span>
</span>
)
}
};
}
but in fact, node.data.name is a key value in the front-end i18n.js, which needs to be converted into corresponding Chinese and English content
with & dollar;t. But I don"t know how to use $t in the rendering function. Please do not hesitate to comment. Thank you