border.uvue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <!-- #ifdef APP -->
  3. <scroll-view style="flex: 1">
  4. <!-- #endif -->
  5. <view style="flex-grow: 1;">
  6. <view>
  7. <text>border: 5px dotted blue</text>
  8. <view class="common" style="border: 5px dotted blue;"></view>
  9. </view>
  10. <view>
  11. <text>border与background-image同时设置</text>
  12. <view class="common"
  13. style="border-style: solid;border-color: rgba(0, 0, 255, 0.1);background-image: linear-gradient(to right, #00ff00, #00bc79)">
  14. </view>
  15. </view>
  16. <view>
  17. <text>设置border的view,通过v-show控制显示</text>
  18. <view v-show="shown">
  19. <view class="common" style="border: 5px dotted blue;">
  20. </view>
  21. </view>
  22. </view>
  23. <view>
  24. <text>设置border 多次赋值的场景</text>
  25. <view>
  26. <view class="common multi-times-border">
  27. </view>
  28. <view class="multi-times-border" style="width: 250px;height: 250px;">
  29. </view>
  30. <view class="multi-times-border" style="border-right: 6px solid blue; width: 250px;height: 250px;">
  31. </view>
  32. <view class="common multi-times-border" style='border: dashed'></view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- #ifdef APP -->
  37. </scroll-view>
  38. <!-- #endif -->
  39. </template>
  40. <script setup lang="uts">
  41. const shown = ref(false)
  42. setTimeout(() => {
  43. shown.value = true
  44. }, 1000);
  45. </script>
  46. <style>
  47. .common {
  48. width: 250px;
  49. height: 250px;
  50. background-color: gray;
  51. }
  52. .multi-times-border {
  53. border: 3px solid red;
  54. border-right-color: blue;
  55. }
  56. .common.multi-times-border {
  57. border-right-color: green;
  58. }
  59. .multi-times-border {
  60. border-right: 6px solid green;
  61. }
  62. </style>