From 24c6e3aa9f9e1607013cf5c91a628000ceb9207e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Wed, 10 Sep 2025 11:59:03 +0800 Subject: [PATCH] =?UTF-8?q?```=20refactor(tailwind.config.js):=20=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E9=83=A8=E5=88=86Tailwind=20CSS=E7=B1=BB=E4=BB=A5?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为了解决微信小程序中的兼容性问题,禁用了以下Tailwind CSS类: - `gap`:微信小程序不支持 gap 属性- `lineClamp`:微信小程序不支持 line-clamp 类 - `textIndent`:禁用 text-indent - `writingMode`:禁用 writing-mode - `hyphens`:禁用 hyphens ``` --- src/app.scss | 9 +++++++++ src/components/AdminPanel.tsx | 2 +- tailwind.config.js | 9 ++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/app.scss b/src/app.scss index bba470e..ae872ba 100644 --- a/src/app.scss +++ b/src/app.scss @@ -92,3 +92,12 @@ button[open-type="chooseAvatar"] { image { margin: 0; /* 全局设置图片的 margin */ } + +/* 管理员面板功能项交互效果 */ +.admin-feature-item { + transition: transform 0.15s ease-in-out; +} + +.admin-feature-item:active { + transform: scale(0.95); +} diff --git a/src/components/AdminPanel.tsx b/src/components/AdminPanel.tsx index a019812..30aa14c 100644 --- a/src/components/AdminPanel.tsx +++ b/src/components/AdminPanel.tsx @@ -117,7 +117,7 @@ const AdminPanel: React.FC = ({ {adminFeatures.map((feature) => ( diff --git a/tailwind.config.js b/tailwind.config.js index ceb303b..d257697 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -2,11 +2,12 @@ module.exports = { content: ['./src/**/*.{js,jsx,ts,tsx}'], darkMode: 'media', // or 'media' or 'class' + // 禁用 important 语法,微信小程序不支持 .\! 这样的选择器 theme: { extend: {}, }, variants: { - extend: {}, + // 禁用所有变体,避免生成微信小程序不支持的选择器 }, plugins: [], corePlugins: { @@ -24,5 +25,11 @@ module.exports = { textIndent: false, // 禁用 text-indent writingMode: false, // 禁用 writing-mode hyphens: false, // 禁用 hyphens + // 禁用所有可能包含问题的变体 + visibility: false, // 禁用 visibility 相关类,避免生成 .\!visible + // 禁用伪类和交互变体,避免生成 .active\: 等选择器 + scale: false, // 禁用 scale 相关类,避免生成问题选择器 + transform: false, // 禁用 transform 相关类 + transitionProperty: false, // 禁用 transition 相关类 }, };