Open davestewart opened 7 years ago
I think that it's caused by the extra :
, so it should just become as follows:
export default {
name: 'Sidebar',
props: ['active'],
computed () {
active () => {
console.log(this)
return this.active
}
}
}
Hey,
I know the demo code is just to start us off, but I'm getting a linter error, and when I look at the JS, I don't actually understand the syntax.
The error is:
The code is:
https://github.com/Metnew/vue-element-starter/blob/master/client/components/Sidebar/index.vue#L33-L38
So even though the syntax looks "wrong" to me, but webpack compiles OK.
The
computed
object looks to me to be using shorthand method syntax (even a colleague agreed) yet the Vue docs saycomputed
should be an Object.If I remove the
()
(which I think should makecomputed
a function with a body that doesn't make sense) then Webpack complains and the component doesn't compile.What is this weird object / function syntax!? Is this ES6, or something that gets bent to the will of Webpack!?
Again, sorry to ask you something that is outside of the scope of a traditional bug, but I can't compile if I do things what I think should be a normal ES6 way.
Thanks, Dave