Answer the question
In order to leave comments, you need to log in
Why won't Vue let you use the if directive in render?
render: function (h) {
return h('div', {
directives: [{name: 'if', value: this.List.length > 5}]
})
}
[Vue warn]: Failed to resolve directive: if
(found in <Anonymous>)
Answer the question
In order to leave comments, you need to log in
We read the documentation and see that if/model directives are not used directly in the render function. This one looks more like React than Angular:
render: function (h) {
if (this.List.length <= 5) return h('');
return h('div', { ... });
}
display: none
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question