App.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <script setup>
  2. import {reactive, onMounted, ref} from 'vue'
  3. const ageModalVisible = ref(true);
  4. const confirmEnter = () => {
  5. ageModalVisible.value = false;
  6. };
  7. const denyEnter = () => {
  8. window.location.href = 'https://www.gov.hk/tc/theme/psi/';
  9. };
  10. // 接受 对象类型 数据的参数传入并返回一个响应式的对象
  11. const state = reactive({
  12. count:0
  13. })
  14. // 简单类型
  15. const count =ref(0)
  16. const setCount = ()=>{
  17. state.count++
  18. console.log(state);
  19. }
  20. const addcount =()=>{
  21. count.value++
  22. console.log(count);
  23. }
  24. </script>
  25. <template>
  26. <div v-if="ageModalVisible" class="age-modal">
  27. <div class="age-modal-content">
  28. <div class="age-modal-title">本人年满18岁声明</div>
  29. <div class="age-modal-desc">
  30. 根据香港法律,不得在业务过程中,向未成年人售卖或供应烟。<br>
  31. <span style="font-size:0.95rem;color:#666;">
  32. Under the law of Hong Kong, tobacco must not be sold or supplied to a minor in the course of business.
  33. </span>
  34. </div>
  35. <div class="age-modal-actions">
  36. <button class="age-btn deny" @click="denyEnter">否,未满18岁<br>No, I'm under 18.</button>
  37. <button class="age-btn confirm" @click="confirmEnter">确认进入<br>Confirm</button>
  38. </div>
  39. </div>
  40. </div>
  41. <RouterView/>
  42. </template>
  43. <style lang="scss" scoped>
  44. .test{
  45. // color: $priceColor;
  46. }
  47. </style>
  48. <style scoped>
  49. .age-modal {
  50. position: fixed;
  51. z-index: 99999;
  52. left: 0; top: 0; right: 0; bottom: 0;
  53. background: rgba(0,0,0,0.55);
  54. display: flex;
  55. align-items: center;
  56. justify-content: center;
  57. }
  58. .age-modal-content {
  59. background: #fff;
  60. border-radius: 12px;
  61. box-shadow: 0 4px 32px rgba(0,0,0,0.18);
  62. padding: 2.5rem 2rem 2rem;
  63. max-width: 350px;
  64. width: 90%;
  65. text-align: center;
  66. }
  67. .age-modal-title {
  68. font-size: 1.3rem;
  69. font-weight: bold;
  70. margin-bottom: 1.2rem;
  71. color: #c9082c;
  72. }
  73. .age-modal-desc {
  74. font-size: 1.05rem;
  75. margin-bottom: 2rem;
  76. color: #333;
  77. }
  78. .age-modal-actions {
  79. display: flex;
  80. justify-content: space-between;
  81. gap: 1.2rem;
  82. }
  83. .age-btn {
  84. flex: 1;
  85. padding: 0.7rem 0.2rem;
  86. border-radius: 6px;
  87. border: none;
  88. font-size: 1rem;
  89. cursor: pointer;
  90. font-weight: bold;
  91. transition: background 0.2s;
  92. }
  93. .age-btn.deny {
  94. background: #eee;
  95. color: #c9082c;
  96. }
  97. .age-btn.confirm {
  98. background: #F7B334;
  99. color: #fff;
  100. }
  101. .age-btn:hover {
  102. opacity: 0.85;
  103. }
  104. </style>