babel-plugin-transform-vue-jsx icon indicating copy to clipboard operation
babel-plugin-transform-vue-jsx copied to clipboard

How to add 'comments' in vue jsx

Open ghost opened this issue 6 years ago • 2 comments

I would like to output a 'comment' node so i can see it in my 'chrome dev tools'

I tried various such as that work in react jsx but not in vuejs jsx.

{/* random comment text */}

I believe the key is the use the vuejs 'createElement' function and generate somehow a comment node like so

h("comment",{ innerText: "random comment text" })

Not sure how and i cant find any documentation for the vue renders function 'createElement'.

ghost avatar Nov 20 '19 03:11 ghost

maybe adding comments in the production code isn't suitable。 issue

JE-lee avatar Feb 14 '20 03:02 JE-lee

const commentNode = h()
commentNode.text = 'random comment text'

cereschen avatar Dec 20 '20 03:12 cereschen