소스 검색

feat(about): 添加切换绑定CSS变量的功能

添加changeTestBindCssVariable函数实现红绿颜色切换
更新测试文案以更明确表达功能
feige996 8 달 전
부모
커밋
e59b0e474b
1개의 변경된 파일12개의 추가작업 그리고 1개의 파일을 삭제
  1. 12 1
      src/pages/about/about.vue

+ 12 - 1
src/pages/about/about.vue

@@ -75,6 +75,14 @@ onShow(() => {
 })
 
 const testBindCssVariable = ref('red')
+function changeTestBindCssVariable() {
+  if (testBindCssVariable.value === 'red') {
+    testBindCssVariable.value = 'green'
+  }
+  else {
+    testBindCssVariable.value = 'red'
+  }
+}
 </script>
 
 <template root="uniKuRoot">
@@ -92,8 +100,11 @@ const testBindCssVariable = ref('red')
       设置tabbarBadge
     </button>
     <RequestComp />
+    <button class="mt-4 w-60 text-center" @click="changeTestBindCssVariable">
+      toggle v-bind css变量
+    </button>
     <view class="test-css text-center">
-      测试v-bind css变量
+      测试v-bind css变量的具体文案
     </view>
     <view class="mb-6 h-1px bg-#eee" />
     <view class="text-center">