Vue : is it possible to import a js scoped only for that component

I am trying to use table component of vue-ant framework. I only want to import the table style. But when trying to import the import 'ant-design-vue/lib/table/style/css' table style all of my elements from other components are affected. Is it possible to use that styling specifically for that component only.

I tried importing it to the <style> tag but I encounter some errors because the less files expect some parameters from the javascript file

1 answer

  • answered 2019-09-10 04:29 andypotato

    You can create scoped styles for your Vue components using the scoped attribute. Then import the style you need into the scoped style.

    <style scoped>
      @import "whatever/you/want/to/import";