Vue-loader: Use transition in css modules

Created on 25 Nov 2016  路  4Comments  路  Source: vuejs/vue-loader

class name in css modules will be compiled to [name]-[hash], but when use transition, it should be [name]-enter-[hash].

<transiton :name="$style.demo">
</transiton>

$style.demo is not compiled, and class name in .css file is compiled to demo-enter-xxxx.

improvement

Most helpful comment

Instead of name, you can also directly use enter-class/leave-class props to directly specify class names instead of relying on auto-inferring.

But as said, this is not really a concern for vue-loader.

All 4 comments

This is not a bug in my view - CSS modules in vue-loader just don't support that currently.

you can use a second <style> element to add transition-relevant CSS in normal , non-modules mode to the SFC.

Instead of name, you can also directly use enter-class/leave-class props to directly specify class names instead of relying on auto-inferring.

But as said, this is not really a concern for vue-loader.

You can use css module selector :global with scss, for example:

<style module lang="scss">
.demo {
  &:global(-enter-active) { /* ... */ }
  &:global(-leave-active) { /* ... */ }
  &:global(-enter) { /* ... */ }
  &:global(-leave-to) { /* ... */ }
}
</style>

this is a nice improvement. would be nice to see it happen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matt-sanders picture matt-sanders  路  4Comments

snoopdouglas picture snoopdouglas  路  3Comments

jorgy343 picture jorgy343  路  3Comments

githoniel picture githoniel  路  3Comments

chrisvfritz picture chrisvfritz  路  4Comments