【问题标题】:How add css and html in vue js Like an angular css ,html and typescript in separate file如何在 vue js 中添加 css 和 html 就像在单独的文件中添加角度 css、html 和 typescript
【发布时间】:2021-09-11 14:03:10
【问题描述】:

如何在 vue js 中分别添加 css 和 html

【问题讨论】:

    标签: html css typescript vue.js vue-component


    【解决方案1】:

    你可以制作一个像这样的文件组件:

    <template>
      <div>This will be pre-compiled</div>
    </template>
    <script src="./my-component.js"></script>
    <style src="./my-component.css"></style>
    

    【讨论】:

    • 你的意思是我创建了三个单独的文件,例如 component.js , component.css 和 component.HTML 并在 component.HTML 中导入 component.js , component.css 路径
    • 三个文件,component.vue,其中包含上面的代码以及 .js 和 .css 文件
    • 另外,你可以直接在 内的组件中编写你的 css 代码。此外,它允许使用 的属性范围为特定组件分离样式
    猜你喜欢
    • 1970-01-01
    • 2023-02-02
    • 1970-01-01
    • 1970-01-01
    • 2017-09-20
    • 1970-01-01
    • 1970-01-01
    • 2017-02-08
    • 2021-12-04
    相关资源
    最近更新 更多