12

I have a Vue component which has a custom render method. The method is not getting called however.

<template>
  <div class="guide"></div>
</template>

<script>
export default {
  name: 'guide',
  render: function(createElement){
    return createElement('div', 'this will never get called?'),
  },
};
</script>

I've looked through the documentation on single file components but it makes no reference to any caveats regarding render(). Is there another way to call this method?

0

1 Answer 1

16

As ABDEL-RHMAN suggested, removing the template will cause the code to work; the <template> causes the render method to be ignored. Working example:

<script>
export default {
  name: 'guide',
  render: function(createElement){
    return createElement('div', 'this will get called?'),
  },
};
</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.