Przeglądaj źródła

添加 weapp-tailwindcss 兼容支持

icssoa 3 miesięcy temu
rodzic
commit
6c38e29c7b

+ 8 - 0
cool/theme/index.ts

@@ -168,24 +168,32 @@ export const setH5 = () => {
 	const navBgColor = getConfig("navBgColor");
 	const navTextStyle = getConfig("navTextStyle");
 
+	// 设置主题类
+	document.documentElement.classList.toggle("dark", isDark.value);
+
+	// 设置背景色
 	document.body.style.setProperty("--background-color-content", bgContentColor);
 
+	// 设置 tabbar 背景色
 	const tabbar = document.querySelector(".uni-tabbar");
 	if (tabbar) {
 		(tabbar as HTMLElement).style.backgroundColor = tabBgColor;
 	}
 
+	// 设置页面头部背景色和文字颜色
 	const pageHead = document.querySelector(".uni-page-head");
 	if (pageHead) {
 		(pageHead as HTMLElement).style.backgroundColor = navBgColor;
 		(pageHead as HTMLElement).style.color = navTextStyle;
 	}
 
+	// 设置页面头部按钮路径颜色
 	const pageHeadBtnPath = document.querySelector(".uni-page-head-btn path");
 	if (pageHeadBtnPath) {
 		(pageHeadBtnPath as HTMLElement).style.fill = navTextStyle;
 	}
 
+	// 发送主题变化消息
 	window.parent.postMessage(
 		{
 			type: "theme-change",

+ 1 - 1
package.json

@@ -15,7 +15,7 @@
 		"@babel/parser": "^7.27.5",
 		"@babel/types": "^7.27.6",
 		"@cool-vue/ai": "^1.1.7",
-		"@cool-vue/vite-plugin": "^8.2.19",
+		"@cool-vue/vite-plugin": "^8.2.20",
 		"@dcloudio/types": "^3.4.16",
 		"@types/node": "^24.0.15",
 		"@vue/compiler-sfc": "^3.5.16",

Plik diff jest za duży
+ 244 - 236
pnpm-lock.yaml


+ 53 - 25
uni_modules/cool-ui/components/cl-button/cl-button.uvue

@@ -527,26 +527,6 @@ function onTouchCancel() {
 </script>
 
 <style lang="scss" scoped>
-@mixin button-type($color) {
-	@apply bg-#{$color}-500;
-
-	&.cl-button--hover {
-		@apply bg-#{$color}-600;
-	}
-
-	&.cl-button--text {
-		background-color: transparent;
-
-		&.cl-button--hover {
-			@apply bg-transparent opacity-50;
-		}
-	}
-
-	&.cl-button--border {
-		@apply border-#{$color}-500;
-	}
-}
-
 .cl-button {
 	@apply flex flex-row items-center justify-center relative box-border;
 	@apply border border-transparent border-solid;
@@ -593,23 +573,63 @@ function onTouchCancel() {
 	}
 
 	&--primary {
-		@include button-type("primary");
+		@apply bg-primary-500;
+
+		&.cl-button--hover {
+			@apply bg-primary-600;
+		}
+
+		&.cl-button--border {
+			@apply border-primary-500;
+		}
 	}
 
 	&--warn {
-		@include button-type("yellow");
+		@apply bg-yellow-500;
+
+		&.cl-button--hover {
+			@apply bg-yellow-600;
+		}
+
+		&.cl-button--border {
+			@apply border-yellow-500;
+		}
 	}
 
 	&--error {
-		@include button-type("red");
+		@apply bg-red-500;
+
+		&.cl-button--hover {
+			@apply bg-red-600;
+		}
+
+		&.cl-button--border {
+			@apply border-red-500;
+		}
 	}
 
 	&--info {
-		@include button-type("surface");
+		@apply bg-surface-500;
+
+		&.cl-button--hover {
+			@apply bg-surface-600;
+		}
+
+		&.cl-button--border {
+			@apply border-surface-500;
+		}
 	}
 
 	&--success {
-		@include button-type("green");
+		@apply bg-green-500;
+
+		&.cl-button--hover {
+			@apply bg-green-600;
+		}
+
+		&.cl-button--border {
+			@apply border-green-500;
+		}
 	}
 
 	&--light {
@@ -663,6 +683,14 @@ function onTouchCancel() {
 			@apply border-surface-500;
 		}
 	}
+
+	&--text {
+		@apply bg-transparent;
+
+		&.cl-button--hover {
+			@apply bg-transparent opacity-50;
+		}
+	}
 }
 
 .cl-button {

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików