1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <view class="hotel-name">
- <view class="hotel-name--fix" :style="[fixStyle]"></view>
- <view class="hotel-name--content" :style="[hotelNameFontSize]">
- <text>{{ hotel.name }}</text>
- </view>
- <view class="hotel-name--fix" @click="gotoSelectHotel" id="changeHotel">
- <image src="/static/switch.svg" style="width: 30rpx; height: 30rpx;"></image>
- 切换
- </view>
- </view>
- </template>
- <script setup>
- import {
- computed
- } from 'vue'
- import {
- useHotelStore
- } from '@/store/hotelStore.js'
- let hotel = useHotelStore().hotel
- let fixStyle = computed(() => {
- let style = {}
- if (hotel.hasOwnProperty('name') && hotel.name.length <= 14) return style
- style.display = "none"
- return style
- })
- let hotelNameFontSize = computed(() => {
- let style = {}
- if (hotel.hasOwnProperty('name') && hotel.name.length <= 14) return style
- style.fontSize = "30rpx"
- return style
- })
- function gotoSelectHotel() {
- uni.redirectTo({
- url: '/subpkg/selectHotel/selectHotel?source=home'
- })
- }
- </script>
- <style lang="scss">
- .hotel-name {
- margin: 20rpx 40rpx;
- display: flex;
- flex-direction: row;
- color: #ffffff;
- background-color: hsla(0, 100%, 0%, 0.5);
- padding: 20rpx 0;
- border-radius: 10rpx;
- transform: translateY(-80rpx);
- .hotel-name--fix {
- font-size: 20rpx;
- width: 100rpx;
- height: 100%;
- padding-right: 16rpx;
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- .hotel-name--content {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
- </style>
|