我想移植我的 vue 指令来渲染服务器端。
客户端:
mydirective(el,binding,vnode){
el.innerText = vnode.context.$data.points
}
到目前为止我在 nuxt.config.js 中所做的工作:
render: {
bundleRenderer: {
directives: {
mydirective(node, binding){
var points = node.context.$data.points //works
node.data.style = [{backgroundColor: 'green'}] //works
node.data.innerText = points //NOT working
node.data.textContent = points //NOT working
}
我找不到元素参考。
我使用以下函数搜索节点对象:
Object.keys(node).forEach(key=>{
console.log(key)
console.log( node[key])
console.log('============================%%%%%%%%%%%%%%%%%%%%%================================')
})
enter code here