Accessing props in vue component data function
问题 I am passing a props to a component: <template> {{messageId}} // other html code </template> <script> export default { props: ['messageId'], data: function(){ var theData={ // below line gives ReferenceError messageId is not defined somevar: messageId, // other object attributes } } } </script> In above code, I have commented the line that gives the error. If I remove that line, it works as normal and template renders properly (and I can see the expected value of {{messageId}} as well). Hence