# SubmitService 按钮提交 
统一封装。不用算高度了。自带登录逻辑。
# 基础用法
<template>
<qinui-theme v-model="theInited">
<!-- 全屏使用 -->
<qinui-submit-service
zIndex="2000"
fixed
phone=""
:getData="getData1"
:extData="{
shopId: 21,
}"
minHeight="100vh"
@click="onSave"
@buttonInited="onBtnInited"
ref="theService"
>
<!-- 部分使用 -->
<qinui-submit-service phone="13011805800" @click="onSave" />
<qinui-submit-service
:getData="getData1"
:extData="{
shopId: 21,
}"
zIndex="3000"
/>
<qinui-submit-service
:getData="getData2"
:extData="{
shopId: 21,
}"
zIndex="3000"
/>
<div>
<div style="height: 2000rpx; background-color: aqua" />
<div>底部了</div>
</div>
<template v-slot:button>
<div :style="btnStyle" v-if="btnStyle" @click="onRefund">退款</div>
</template>
</qinui-submit-service>
</qinui-theme>
</template>
<script>
import { theData1, theData2 } from '../../demos/action-sheet-service/conf';
import { onMounted, ref, shallowRef } from 'vue';
export default {
data() {
return {};
},
onLoad() {},
setup() {
const theInited = shallowRef(false);
const btnStyle = shallowRef('');
const theService = ref();
onMounted(() => {
theInited.value = true;
});
return {
theService,
theInited,
btnStyle,
};
},
methods: {
onSave: (theEv) => {
console.log(theEv, 'theEv');
},
getData1() {
return new Promise((resolve) => {
resolve(theData1);
});
},
onBtnInited(theBtnStyle) {
console.log(theBtnStyle, '按钮样式');
this.btnStyle = theBtnStyle;
},
getData2() {
return new Promise((resolve) => {
resolve(theData2);
});
},
onRefund() {
this.$refs.theService?.onShowKefu?.();
},
},
};
</script>
# API
# Props
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|---|---|---|---|---|
| phone | 如果存在点击客服直接拨打电话 | String | Number | - | - |
| buttonText | 按钮文案 | String | 联系客服 | - |
| zIndex | 层级 | String | Number | - | - |
| minHeight | 最小高度 | String | - | - |
| fixed | 是否固定在底部 | Boolean | false | - |
| useLogin | 是否使用登录组件,示例 | Boolean | false | true | false |
| loginContent | 未登录文案 | String | - | - |
| logined | 是否登录 | Boolean | false | true | false |
| h5Auth | H5 点击回调 | Function | - | - |
| minAfterAuth | 小程序 点击回调 | Function | - | - |
| serviceExtData | 客服接口透传参数 | Object | - | - |
| isAll | 是否全量获取数据 | Boolean | false | true | false |
| webviewPageName | webview 的路由名字 | String | Webview | - |
| extData | 传给接口的扩展参数 | Object | {} | - |
| getData | 获取数据的接口方法 ( Promise ) | Function | - | - |
| diyStyle | 自定义外部样式,如:设置边框等样式 | String | - | - |
# Events
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| @click | 按钮触发 | - |
| @inited | 初始化触发 | - |