122 行
3.1 KiB
Vue
122 行
3.1 KiB
Vue
<template>
|
|
<view class="ss-flex ss-col-center">
|
|
<view
|
|
v-if="data.type === 'text'"
|
|
class="nav-title inline"
|
|
:style="[{ color: data.textColor, width: width }]"
|
|
>
|
|
{{ data.text }}
|
|
</view>
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
<button
|
|
v-if="data.type === 'image' && isCustomerService"
|
|
:style="[{ width: width }]"
|
|
class="ss-reset-button menu-icon-wrap ss-flex ss-row-center ss-col-center"
|
|
open-type="contact"
|
|
>
|
|
<image
|
|
class="nav-image"
|
|
:src="data.src && data.src.startsWith('/static/') ? data.src : sheep.$url.cdn(data.src)"
|
|
mode="aspectFit"
|
|
></image>
|
|
</button>
|
|
<view
|
|
v-else-if="data.type === 'image'"
|
|
:style="[{ width: width }]"
|
|
class="menu-icon-wrap ss-flex ss-row-center ss-col-center"
|
|
@tap="sheep.$router.go(data.url)"
|
|
>
|
|
<image
|
|
class="nav-image"
|
|
:src="data.src && data.src.startsWith('/static/') ? data.src : sheep.$url.cdn(data.src)"
|
|
mode="aspectFit"
|
|
></image>
|
|
</view>
|
|
<!-- #endif -->
|
|
<!-- #ifndef MP-WEIXIN -->
|
|
<view
|
|
v-if="data.type === 'image'"
|
|
:style="[{ width: width }]"
|
|
class="menu-icon-wrap ss-flex ss-row-center ss-col-center"
|
|
@tap="sheep.$router.go(data.url)"
|
|
>
|
|
<image
|
|
class="nav-image"
|
|
:src="data.src && data.src.startsWith('/static/') ? data.src : sheep.$url.cdn(data.src)"
|
|
mode="aspectFit"
|
|
></image>
|
|
</view>
|
|
<!-- #endif -->
|
|
<view class="ss-flex-1" v-if="data.type == 'search'" :style="[{ width: width }]">
|
|
<s-search-block
|
|
:placeholder="data.placeholder || '搜索关键字'"
|
|
:radius="data.borderRadius"
|
|
elBackground="#fff"
|
|
:height="height"
|
|
:width="width"
|
|
@click="sheep.$router.go('/pages/index/search')"
|
|
></s-search-block>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import sheep from '@/sheep';
|
|
import { computed } from 'vue';
|
|
|
|
// 接收参数
|
|
const props = defineProps({
|
|
data: {
|
|
type: Object,
|
|
default: () => ({}),
|
|
},
|
|
width: {
|
|
type: String,
|
|
default: '1px',
|
|
},
|
|
});
|
|
|
|
const height = computed(() => sheep.$platform.capsule.height);
|
|
|
|
// 判断是否为客服入口
|
|
const isCustomerService = computed(() => {
|
|
const url = props.data?.url || '';
|
|
const src = props.data?.src || '';
|
|
return (
|
|
url === '/pages/chat/index' ||
|
|
url.startsWith('/pages/chat') ||
|
|
url.includes('chat') ||
|
|
url.includes('kefu') ||
|
|
url.includes('customer_service') ||
|
|
src.includes('c47b048175b325b1e78f837a3b696794')
|
|
);
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.nav-title {
|
|
font-size: 36rpx;
|
|
color: #333;
|
|
text-align: center;
|
|
}
|
|
|
|
.menu-icon-wrap {
|
|
width: 100%;
|
|
height: 100%;
|
|
background: transparent;
|
|
border: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
line-height: normal;
|
|
|
|
&::after {
|
|
border: none;
|
|
}
|
|
|
|
.nav-image {
|
|
height: 30px;
|
|
max-width: 100%;
|
|
}
|
|
}
|
|
</style>
|