<template>
|
<div class="container" :class="isHome ? 'top-[100%] mt-[8px]' : 'bottom-[100%] mb-[8px]'">
|
<div class="container_header">
|
<div class="title">常用语</div>
|
<span class="ywifont ywicon-guanbi text-[15px] cursor-pointer text-[#767a97]" @click="closeCommonPhrases"></span>
|
</div>
|
<div class="container_content">
|
<div class="set_phrases" :style="{ height: commonPhrases.length * 40 + 'px' }">
|
<div class="w-full h-full absolute top-0">
|
<div class="py-0 mt-0 box-border h-full">
|
<div style="overflow-anchor: none" v-for="(item, index) in commonPhrases" :key="index">
|
<div class="phase_item">
|
<div class="flex flex-col">
|
<div class="title">
|
{{ item.title }}
|
</div>
|
<div class="content">
|
{{ item.content }}
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="container_add">
|
<span class="ywifont ywicon-jia text-[15px] cursor-pointer text-[#767a97]"></span>
|
</div>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import { ref } from 'vue';
|
const commonPhrases = ref([
|
{
|
id: 1,
|
title: '你好,请问有什么可以帮助您?',
|
content: '您好,我想咨询一下关于您的订单。',
|
},
|
{
|
id: 2,
|
title: '测试1?',
|
content: '我想咨询一下关于您的订单。',
|
},
|
{
|
id: 3,
|
title: '测试2?',
|
content: '我想咨询一下关于您的订单。',
|
},
|
]);
|
const props = defineProps(['isHome']);
|
const closeCommonPhrases = () => {};
|
</script>
|
<style scoped lang="scss">
|
.container {
|
position: absolute;
|
width: 100%;
|
max-height: 45vh;
|
padding: 0 8px 8px;
|
left: 0px;
|
border-radius: 12px;
|
background-color: #ffffff;
|
border: 1px solid #e5e5e5;
|
box-shadow: 0px 8px 25px 0px #0000000d;
|
display: flex;
|
flex-direction: column;
|
z-index: 100;
|
&_header {
|
width: 100%;
|
display: flex;
|
flex-direction: row;
|
justify-content: space-between;
|
align-items: center;
|
padding: 10px 6px;
|
color: #060607;
|
.title {
|
font-size: 14px;
|
color: #060607;
|
font-weight: 600;
|
line-height: 20px;
|
letter-spacing: 0.25px;
|
flex-grow: 1;
|
display: flex;
|
}
|
}
|
&_content {
|
width: 100%;
|
max-height: 40vh;
|
height: fit-content;
|
.set_phrases {
|
outline: none;
|
overflow-y: auto;
|
position: relative;
|
transition: height 0.1s linear;
|
.phase_item {
|
display: flex;
|
flex-direction: row;
|
justify-content: space-between;
|
align-items: center;
|
cursor: pointer;
|
padding: 6px 8px;
|
flex-shrink: 0;
|
background: #fff;
|
border-radius: 8px;
|
width: 100%;
|
.title {
|
font-size: 14px;
|
color: #060607;
|
font-family: PingFang HK;
|
font-weight: 600;
|
font-style: normal;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
overflow: hidden;
|
}
|
.content {
|
font-size: 12px;
|
color: #5e6772;
|
font-family: PingFang SC;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
overflow: hidden;
|
}
|
}
|
}
|
}
|
&_add {
|
display: flex;
|
flex-direction: row;
|
align-items: center;
|
cursor: pointer;
|
padding: 6px 8px;
|
background: #fff;
|
border-radius: 8px;
|
}
|
}
|
</style>
|