首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Vue web组件中不工作的顺风css

在Vue web组件中不工作的顺风css
EN

Stack Overflow用户
提问于 2022-04-09 18:26:42
回答 1查看 2.4K关注 0票数 2

我有一个Vue web组件。当我将它构建为一个普通的Vue组件时,一切都很好。然而,它失去了所有的Tailwind样式,我立即将它转换为Vue Web组件。谢谢你提前帮忙。

tailwind.config.js

代码语言:javascript
复制
module.exports = {
  content: [
    "./index.html",
    "./src/**/*.{vue,js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {
      colors: {
      },
    },
  },
  plugins: [
  ],
}

tailwind.css

代码语言:javascript
复制
@tailwind base;
@tailwind components;
@tailwind utilities;

还有我的vite.config.js

代码语言:javascript
复制
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue({
    template: {
      compilerOptions: {
        // treat all tags with a dash as custom elements
        isCustomElement: (tag) => tag.includes('-')
      }
    }
  })],
  build: {
    lib: {
      entry: './src/entry.js',
      formats: ['es','cjs'],
      name: 'web-component',
      fileName: (format)=>(format === 'es' ? 'index.js' : 'index.cjs')
    },
    sourcemap: true,
    target: 'esnext',
    minify: false
  }
})
EN

回答 1

Stack Overflow用户

发布于 2022-04-11 06:52:21

无论如何,就目前而言,我所做的就是将Tailwind直接添加到web组件中,并且它可以工作。

代码语言:javascript
复制
<style>
 @import url("../tailwind.css");
</style>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71810799

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档