123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <template>
- <Transition name="fade-out">
- <div
- v-show="isShow"
- class="operation-tip"
- >
- <div
- v-if="props.text"
- class="text"
- >
- {{ props.text }}
- </div>
- <img
- class=""
- :src="require(`@/assets/images/icon_operation_${props.direction}_${props.color}.png`)"
- alt=""
- draggable="false"
- >
- </div>
- </Transition>
- </template>
- <script setup>
- import useSizeAdapt from "@/useFunctions/useSizeAdapt"
- import { ref, computed, watch } from "vue"
- const {
- windowSizeInCssForRef,
- windowSizeWhenDesignForRef,
- } = useSizeAdapt()
- const props = defineProps({
- direction: {
- type: String,
- default: 'v', // h
- },
- color: {
- type: String,
- default: 'white', // 'green'
- },
- text: {
- type: String,
- default: '',
- },
- isShow: {
- type: Boolean,
- default: true,
- }
- })
- const color = computed(() => {
- if (props.color === 'white') {
- return '#fff'
- } else if (props.color === 'green') {
- return '#7B916B'
- } else {
- return props.color
- }
- })
- const isShow = ref(true)
- const propIsShow = computed(() => {
- return props.isShow
- })
- watch(propIsShow, (v) => {
- if (!v) {
- isShow.value = false
- }
- })
- // setTimeout(() => {
- // isShow.value = false
- // }, 2000)
- </script>
- <style lang="less" scoped>
- .operation-tip{
- position: fixed;
- display: flex;
- align-items: center;
- >.text{
- color: v-bind('color');
- margin-right: calc(5 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- font-family: KaiTi;
- font-weight: 400;
- font-size: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- }
- >img{
- width: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- height: calc(41 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- }
- }
- </style>
|