Vue-loader: $style not set when using vue-class-component decorator

Created on 16 Dec 2016  路  2Comments  路  Source: vuejs/vue-loader

I'm working on a proof of concept with TypeScript and vue-class-component and have an issue with <style module> not working.

Basically the computed $styles property never ends up on the exported definition. This only happens when the component has no other computed properties defined. If you add a placeholder it will work:

get $style() {
  return {};
}

I believe this is just the nature of the beast with the way annotations work. Since the options are wrapped in a closure, if you don't have a reference to the computed object in there from the start then the logic in vue-loader that defines computed[$style] puts it in the wrong place.

I'm not sure that there is a way to fix it (other than the workaround mentioned) but I figured I would put this up for discussion. I made an update to vue-class-component to define a computed object if one is not provided which works, but seems like an edge case that doesn't belong in that lib...

css modules

Most helpful comment

Original issue is fixed now. Will be out in Vue core 2.2.

All 2 comments

Original issue is fixed now. Will be out in Vue core 2.2.

Was this page helpful?
0 / 5 - 0 ratings