Skip to content

完全按照官方文档来,依然用不了tailwind (vue3) #18254

@haro1d

Description

@haro1d

相关平台

H5

复现仓库

https://gitee.com/yeungsj/taro-vue3-tailwind-vite-test.git
浏览器版本: chrome 版本 139.0.7258.128(正式版本) (64 位)
使用框架: Vue 3

复现步骤

问题一:tailwind无法使用,准确来说,
Hello world!
Hello world!
这两行代码的样式都没有生效

问题二:const onClick2 = () => {
Taro.showToast({
title: "成功",
icon: "success",
duration: 2000,
});
};
报错Uncaught TypeError: Taro.showToast is not a function

期望结果

期望能正常使用tailwind和Taro自带的API

实际结果

实际结果是都用不了

环境信息

PS D:\_front\taro2> taro info
� Taro v4.1.5


  Taro CLI 4.1.5 environment info:
    System:
      OS: Windows 11 10.0.26100
    Binaries:
      Node: 22.17.1 - C:\nvm4w\nodejs\node.EXE
      npm: 10.9.2 - C:\nvm4w\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 4.1.5 => 4.1.5
      @tarojs/components: 4.1.5 => 4.1.5
      @tarojs/helper: 4.1.5 => 4.1.5
      @tarojs/plugin-framework-vue3: 4.1.5 => 4.1.5
      @tarojs/plugin-html: 4.1.5 => 4.1.5
      @tarojs/plugin-platform-alipay: 4.1.5 => 4.1.5
      @tarojs/plugin-platform-h5: 4.1.5 => 4.1.5
      @tarojs/plugin-platform-jd: 4.1.5 => 4.1.5
      @tarojs/plugin-platform-qq: 4.1.5 => 4.1.5
      @tarojs/plugin-platform-swan: 4.1.5 => 4.1.5
      @tarojs/plugin-platform-tt: 4.1.5 => 4.1.5
      @tarojs/plugin-platform-weapp: 4.1.5 => 4.1.5
      @tarojs/runtime: 4.1.5 => 4.1.5
      @tarojs/shared: 4.1.5 => 4.1.5
      @tarojs/taro: 4.1.5 => 4.1.5
      @tarojs/vite-runner: 4.1.5 => 4.1.5
      babel-preset-taro: 4.1.5 => 4.1.5
      eslint-config-taro: 4.1.5 => 4.1.5

补充信息

https://docs.taro.zone/docs/tailwindcss
tailwind的配置我完全是按照这个官方文档地址来操作的

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions