VBindCss.vue 652 B

1234567891011121314151617181920212223242526272829
  1. <script lang="ts" setup>
  2. // root 插件更新到 1.3.4之后,都正常了。
  3. const testBindCssVariable = ref('red')
  4. function changeTestBindCssVariable() {
  5. if (testBindCssVariable.value === 'red') {
  6. testBindCssVariable.value = 'green'
  7. }
  8. else {
  9. testBindCssVariable.value = 'red'
  10. }
  11. }
  12. </script>
  13. <template>
  14. <button class="mt-4 w-60 text-center" @click="changeTestBindCssVariable">
  15. toggle v-bind css变量
  16. </button>
  17. <view class="test-css my-2 text-center">
  18. 测试v-bind css变量的具体文案
  19. </view>
  20. </template>
  21. <style lang="scss" scoped>
  22. .test-css {
  23. color: v-bind(testBindCssVariable);
  24. font-size: 24px;
  25. }
  26. </style>