@@ -1,52 +1,84 @@
< template >
< view >
< view class = "talk-btns-components" : class = "{action:isRecording, inputMode:!isInputVisible}" >
< view class = "talk-btns-components" : class = "{ action: isRecording, inputMode: !isInputVisible }" >
< view class = "touch-btn" @click ="disabled_click" >
< button v-if = "!isTextOnlyMode && isInputVisible" class="voice-btn" @touchstart="startRecord"
@touchend ="stopRecord()" @touchmove ="handleMove" @touchcancel ="stopRecord()" :plain = "true" >
< button
v-if = "isInputVisible"
class = "voice-btn"
@touchstart ="startRecord"
@touchend ="stopRecord()"
@touchmove ="handleMove"
@touchcancel ="stopRecord()"
:plain = "true"
>
< text class = "voice-text" > { { isRecording ? '松开发送' : '按住说话' } } < / text >
< / button >
< input v-if = "!isVoiceOnlyMode && !isInputVisible" class="input-box" ref="inputRef" v-model="inputText"
:maxlength = "props.maxlength" :adjustPosition = "true"
placeholderStyle = "color:#999999;font-size:26rpx" placeholder = "请输入文字 "
:disabled = "props.isDisabled" @click ="disabled_click" > < / input >
< input
v-if = "!isVoiceOnlyMode && !isInputVisible"
class = "input-box "
ref = "inputRef"
v-model = "inputText"
:maxlength = "props.maxlength"
:adjustPosition = "true"
placeholderStyle = "color:#999999;font-size:26rpx"
placeholder = "请输入文字"
:disabled = "props.isDisabled"
@click ="disabled_click"
/ >
< / view >
< view class = "talk-right-icon-div" v-if = "!isTextOnlyMode && !isVoiceOnlyMode" >
< view class = "talk-right-icon-div" v-if = "!isVoiceOnlyMode" >
< image class = "talk-right-icon" :src = "talkRightIcon" mode = "widthFix" @click ="changeBtn" > < / image >
< / view >
< / view >
< uni -popup ref = "popupRef" class = "popup" @touchmove.stop.prevent ="false" >
< view class = "overlay-box" >
< view class = "overlay-box" >
< view class = "fl1" > < / view >
< view class = "talk-dialog-box" >
< view class = "talk-dialog-div" :class = "dialogDynamicClasses" >
< view class = "talk-dialog" >
< image :src = "voiceWhiteBtn" mode = "" class = "gif-box" > < / image >
< uv-textarea class = "textarea" ref = "inputRef" v-model = "textAreaText" :maxlength="255" @click.stop
< view class = "talk-dialog" >
< image :src = "TouchBtnImages. voiceWhiteBtn" mode = "" class = "gif-box" > < / image >
< uv-textarea
class = "textarea"
ref = "inputRef"
v-model = "textAreaText"
:maxlength = "255"
@click.stop
customStyle = "background: #ffffff00; padding-bottom: 50rpx; color: #fff; caret-color: #fff"
text -style = " color : # fff " border = "none" placeholderStyle = "color:#999999;font-size:26rpx;"
placeholder = "" > < / uv-textarea >
text -style = " color : # fff "
border = "none "
placeholderStyle = "color:#999999;font-size:26rpx;"
placeholder = ""
> < / uv-textarea >
< view class = "error-tip-div" >
< image :src = "iconRecognizeErrorSvg()" mode = "aspectFill" class = "img" > < / image >
< view class = "" >
未识别到文字
< / view >
< image :src = "TouchBtnImages. iconRecognizeErrorSvg()" mode = "aspectFill" class = "img" > < / image >
< view class = "" > 未识别到文字 < / view >
< / view >
< / view >
< / view >
< / view >
<!-- 第一形态两侧按钮 -- >
< view class = "page-box" :style = "{marginBottom:pageBoxMarginBottom}" >
< view class = "page-box" : style = "{ marginBottom: pageBoxMarginBottom }" >
< view class = "page-1" : class = "[status, props.mode]" >
< view class = "btns-box" >
<!-- 左侧取消按钮 -- >
< image class = "btn-box btn-box-1" : src = "isOutStatus == '02' ? cancelActiveBtn : cancelBtn"
mode = "heightFix" @click ="closePopup()" > < / image >
< image
class = "btn-box btn-box-1"
: src = "isOutStatus == '02' ? TouchBtnImages.cancelActiveBtn : TouchBtnImages.cancelBtn"
mode = "heightFix"
@click ="closePopup()"
> < / image >
<!-- 右侧转文字按钮 -- >
< image class = "btn-box btn-box-2" : src = "isOutStatus == '03' ? translateActiveBtn : translateBtn"
mode = "heightFix" > < / image >
< image class = "btn-box-3" : src = "isOutStatus == '02'? closeActiveBtn : clos eBtn"
mode = "heightFix" @click ="closePopup()" > < / image >
< image
class = "btn-box btn-box-2"
: src = "isOutStatus == '03' ? TouchBtnImages.translateActiveBtn : TouchBtnImages.translat eBtn"
mode = "heightFix"
> < / image >
< image
class = "btn-box-3"
: src = "isOutStatus == '02' ? TouchBtnImages.closeActiveBtn : TouchBtnImages.closeBtn"
mode = "heightFix"
@click ="closePopup()"
> < / image >
< / view >
<!-- 下方按钮 -- >
< view class = "circle-bg-box" >
@@ -54,15 +86,19 @@
< / view >
< / view >
<!-- 第二形态 -- >
< view class = "page-2" : class = "[ status, voice_to_text_status]" >
< view class = "page-2" : class = "[status, voice_to_text_status, props.mode ]" >
<!-- 左侧XX -- >
< view class = "transVoiceIng cancel-btn" @click ="closePopup()" > < text class = "btn-text" > 取消 < / text > < / view >
< view class = "transVoiceIng cancel-btn" @click ="closePopup()" >
< text class = "btn-text" > 取消 < / text >
< / view >
<!-- 中间发送原语音 -- >
< view class = "transVoiceIng trans-btn" @click ="testFun()" > < text class = "btn-text" > 发送原语音 < / text > < / view >
< view class = "transVoiceIng trans-btn" @click ="testFun()" >
< text class = "btn-text" > 发送原语音 < / text >
< / view >
<!-- 右侧发送按钮 ( 椭圆 ) -- >
< view class = "send-btn" @click ="send_msg()" >
< view class = "send-btn-text" > 发送 < / view >
< CommonLoading class = "send-btn-loading" color = "#444" / >
< CommonLoading class = "send-btn-loading" color = "#444" / >
< / view >
< / view >
< / view >
@@ -72,16 +108,13 @@
< / template >
< script setup lang = "ts" >
// 导出图片
import { cancelBtn , cancelActiveBtn , translateBtn , translateActiveBtn , voiceWhiteBtn , closeBtn , closeActiveBtn , icKeyboardSvg , iconMicSvg , iconSendSvg , iconRecognizeErrorSvg } from './touch-btn.imag es' ;
import { StatusType , VoiceToTextSubStatus , ErrorCode } from './touch-btn.types' ;
import type { TouchBtnEmits } from './touch-btn.types' ;
import * as TouchBtnImages from './touch-btn.images' ; // 导出图片
import { StatusType , VoiceToTextSubStatus , ErrorCode } from './touch-btn.typ es' ;
import type { TouchBtnEmits } from './touch-btn.types' ;
import { wsUrl , bottomAreaTopBoundary , horizontalSplitX , initWebSocket , showErrorTip , vibrateLight } from './touch-btn' ;
import { ref , computed , onMounted , nextTick , watch , reactive } from 'vue' ;
import { onHide , onLaunch } from '@dcloudio/uni-app' ;
import common from '@/common/common' ;
import { setupKeyboardHeightListener } from '@/common/common' ;
import common , { setupKeyboardHeightListener } from '@/common/common' ;
import { startAudioRecord , stopAudioRecord , preRequestRecordPermission } from '@/uni_modules/ty-recording' ;
import { ProtocolCodec , MessageType , ControlCommand , ControlCode , ControlBody } from '@/common/protocolCodec' ;
import permissionApi from '@/common/permission' ;
@@ -97,8 +130,8 @@
// mode控制功能模式
mode : {
type : String ,
default : 'voice -only' ,
validator : ( value : string ) => {
default : 'text -only' ,
validator : ( value : string ) => {
return [ 'voice-only' , 'text-only' , 'both' ] . includes ( value ) ;
}
} ,
@@ -147,10 +180,11 @@
} ) ;
const dialogDynamicClasses = computed ( ( ) => {
const classes = [ ] ;
isOutStatus . value === '02' && classes . push ( 'is-out' )
isOutStatus . value === '03' && classes . push ( 'is-translate' )
voice _to _text _status . value !== '' && classes . push ( voice _to _text _status . value )
isOutStatus . value === '02' && classes . push ( 'is-out' ) ;
( isOutStatus . value === '03' || status . value === 'voice_to_text' ) && classes . push ( 'is-translate' ) ;
// 仅语音模式,01松手后要和03操作一样
// isOutStatus.value === '01' && props.mode === 'text-only' && status.value == 'voice_to_text' && classes.push('is-translate');
voice _to _text _status . value !== '' && classes . push ( voice _to _text _status . value ) ;
return classes ;
} ) ;
const recordId = ref ( '' ) ;
@@ -162,23 +196,23 @@
// 是否录音中
const isRecording = ref ( false ) ;
// 键盘还是语音
const isInputVisible = ref ( props . mode !== 'text-only' ) ; // true=显示录音按钮,false=显示输入框
const isInputVisible = ref ( true ) ; // true=显示录音按钮,false=显示输入框
const recordStartTime = ref ( 0 ) ; // 录音开始时间戳
const pressTimer = ref < number | null > ( null ) ;
// 计算属性:判断是否仅语音/仅文字模式(简化模板逻辑)
const isVoiceOnlyMode = computed ( ( ) => props . mode === 'voice-only' ) ;
const isTextOnlyMode = computed ( ( ) => props . mode === 'text-only' ) ;
const talkRightIcon = computed ( ( ) => {
if ( isInputVisible . value ) return icKeyboardSvg ( ) ;
if ( inputText . value ) return iconSendSvg ( ) ;
return iconMicSvg ( ) ;
if ( isInputVisible . value ) return TouchBtnImages . icKeyboardSvg ( ) ;
if ( inputText . value ) return TouchBtnImages . iconSendSvg ( ) ;
return TouchBtnImages . iconMicSvg ( ) ;
} ) ;
// 计算是否超出按下盒子位置01代表下方盒子,02代表左上03代表右上
const isOutStatus = computed ( ( ) => {
const { y : touchY , x : touchX } = touchPos ;
if ( touchY >= bottomAreaTopBoundary ) return '01' ;
// 仅语音模式只能返回02,就是 取消
if ( props . mode === 'voice-only' ) return '02' ;
// 仅语音模式只能返回取消( 02)
if ( props . mode === 'voice-only' ) return '02' ;
return touchX < horizontalSplitX ? '02' : '03' ;
} ) ;
// 监听按下移动
@@ -188,15 +222,16 @@
touchPos . y = pageY ;
} ;
const testFun = ( ) => {
voice _to _text _status . value = 'failed'
}
voice _to _text _status . value = 'failed' ;
} ;
// 开启语音
const startRecord = async ( obj : { touches : any [ ] ; } ) => {
if ( props . isDisabled ) return ;
const startRecord = async ( obj : { touches : any [ ] } ) => {
if ( props . isDisabled ) return ;
try {
const state = await permissionApi . judgeIosPermission ( 'record' ) ;
if ( state === 'not determined' ) { // 苹果专用
preRequestRecordPermission ( ( ) => { } )
if ( state === 'not determined' ) {
// 苹果专用
preRequestRecordPermission ( ( ) => { } ) ;
return ;
}
} catch ( e ) {
@@ -205,51 +240,59 @@
}
// 标记录音开始
isRecording . value = true ;
status . value = 'voice_recording'
voice _to _text _status . value = ''
status . value = 'voice_recording' ;
voice _to _text _status . value = '' ;
tempText . value = '' ;
allText . value = '' ;
initWebSocket ( wsUrl ) . then ( socketTask => {
ws . value = socketTask
wsStatus . value = true ;
console . log ( 'WS连接成功' ) ;
ws . value . onMessage ( ( res : { data : Uint8Array | ArrayBuffer ; } ) => {
try {
const { msgType , body } = ProtocolCodec . unpack ( res . data ) ;
console . log ( 'msgType' , msgType , body ) ;
if ( msgType === MessageType . TEXT _MESSAGE ) {
tempText . value = '' ;
allText . value = allText . value + body ;
} else if ( msgType === MessageType . TIP _MESSAGE ) {
tempText . value = body as string ;
} else if ( msgType === MessageType . CONTROL _CMD ) { // 返回结束消息
const controlBody = body as ControlBody ;
if ( controlBody . type === ControlCode . SERVER _TO _FRONT _OVER ) {
if ( controlBody ? . txt === '' ) { //说明没有识别到文字
voice _to _text _status . value = 'failed'
// todo
} else { // 识别成功
voice _to _text _status . value = 'success '
const ossKey = controlBody ? . ossKey ;
const text = controlBody ? . txt ;
// todo
console . log ( 'ossKey' , ossKey ) ;
emit ( 'submitVoice' , { ossKey , text } )
initWebSocket ( wsUrl )
. then ( ( socketTask ) => {
ws . value = socketTask ;
wsStatus . value = true ;
console . log ( 'WS连接成功' ) ;
ws . value . onMessage ( ( res : { data : Uint8Array | ArrayBuffer } ) => {
try {
const { msgType , body } = ProtocolCodec . unpack ( res . data ) ;
console . log ( 'msgType' , msgType , body ) ;
if ( msgType === MessageType . TEXT _MESSAGE ) {
tempText . value = '' ;
allText . value = allText . value + body ;
} else if ( msgType === MessageType . TIP _MESSAGE ) {
tempText . value = body as string ;
} else if ( msgType === MessageType . CONTROL _CMD ) {
// 返回结束消息
const controlBody = body as ControlBody ;
if ( controlBody . type === ControlCode . SERVER _TO _FRONT _OVER ) {
console . log ( '识别结束' , controlBody ) ;
// if(status.value === 'default') return;
// status.value = 'default'; // 恢复成默认状态
if ( controlBody ? . txt === '' ) {
//说明没有识别到文字
voice _to _text _status . value = 'failed' ;
emit ( 'submitVoice' , { ossKey : '' , text : '' , recordId : recordId . value } ) ;
// todo
} else {
// 识别成功
voice _to _text _status . value = 'success' ;
const ossKey = controlBody ? . ossKey ;
let text = '' ;
if ( typeof controlBody ? . txt === 'string' ) {
text = controlBody . txt . trim ( ) ;
}
emit ( 'submitVoice' , { ossKey , text , recordId : recordId . value } ) ;
}
}
}
} catch ( e ) {
console . log ( '后端发来的信息有问题' ) ;
}
} catch ( e ) {
console . log ( '后端发来的信息有问题' ) ;
}
} ) ;
} )
. catch ( ( ) => {
stopRecord ( 'networkError' ) ;
console . log ( '网络出现问题' ) ;
} ) ;
} ) . catch ( ( ) => {
stopRecord ( 'networkError' )
console . log ( '网络出现问题' ) ;
} )
pressTimer . value = setTimeout ( ( ) => {
vibrateLight ( ) // 触感震动
vibrateLight ( ) ; // 触感震动
// 重设按下位置
const changedTouche = obj . touches [ 0 ] ;
touchPos . x = changedTouche . clientX ;
@@ -259,14 +302,14 @@
// 弹出录音界面
popupRef . value . open ( ) ;
startAudioRecord ( {
onFrame : ( pcmData : any ) => {
onFrame : ( pcmData : any ) => {
if ( wsStatus . value && ws . value ) {
ws . value . send ( { data : ProtocolCodec . pack ( MessageType . AUDIO _DATA , pcmData ) } ) ;
ws . value . send ( { data : ProtocolCodec . pack ( MessageType . AUDIO _DATA , pcmData ) } ) ;
}
} ,
onStart : ( res : any ) => {
onStart : ( res : any ) => {
console . log ( '启动' , res ) ;
recordId . value = res . recordId ? ? ''
recordId . value = res . recordId ? ? '' ;
} ,
onStop : ( ) => {
console . log ( '关闭' ) ;
@@ -278,63 +321,147 @@
}
}
} ) ;
} , 120 )
} , 120 ) ;
} ;
// 结束录音
const closePopup = ( ) => {
popupRef . value . close ( ) ;
}
const stopRecord = async ( errrStatus = '' ) => {
} ;
const stopRecord2 = async ( errrStatus = '' ) => {
clearTimeout ( pressTimer . value ) ;
if ( ! isRecording . value ) return ; // 未处于录音状态
if ( isOutStatus . value === '03' ) {
status . value = 'voice_to_text' //主状态设置为转文字
voice _to _text _status . value = 'init'
} else if ( isOutStatus . value === '01' ) {
status . value = 'voice_send_ing' //主状态设置为语音发送中
status . value = 'voice_to_text' ; //主状态设置为转文字
voice _to _text _status . value = 'init' ;
} else if ( isOutStatus . value === '01' ) {
status . value = 'voice_send_ing' ; //主状态设置为语音发送中
}
if ( [ '01' , '03' ] . includes ( isOutStatus . value ) ) { // 向后端发送抬手动作
ws . value && ws . value . send ( { data : ProtocolCodec . pack ( MessageType . CONTROL _CMD , { type : ControlCode . FRONT _TO _SERVER _OVER } ) } ) ;
if ( [ '01' , '03' ] . includes ( isOutStatus . value ) ) {
// 向后端发送抬手动作
ws . value &&
ws . value . send ( {
data : ProtocolCodec . pack ( MessageType . CONTROL _CMD , { type : ControlCode . FRONT _TO _SERVER _OVER } )
} ) ;
}
const recordDurationMs = Date . now ( ) - recordStartTime . value ;
if ( isOutStatus . value !== '02' ) { // 取消的时候,不校验最低时间
if ( isOutStatus . value !== '02' ) {
// 取消的时候,不校验最低时间
// 核心:计算录音总时长(毫秒转秒,保留1位小数)
if ( recordDurationMs < 600 ) {
await new Promise < void > ( ( resolve ) => {
setTimeout ( ( ) => {
resolve ( )
} , 600 - recordDurationMs )
} )
resolve ( ) ;
} , 600 - recordDurationMs ) ;
} ) ;
}
}
isRecording . value = false ;
if ( isOutStatus . value === '02' || errrStatus === 'networkError' ) { // 取消的时候自己主动关闭websocket,其他的时候需要等待后端的消息关闭
ws . value && ws . value . close ( {
code : 1000 ,
reason : '挂断' ,
complete : ( ) => {
console . log ( '挂断Ws ' ) ;
wsStatus . value = false ;
}
} ) ;
if ( isOutStatus . value === '02' || errrStatus === 'networkError' ) {
// 取消的时候自己主动关闭websocket,其他的时候需要等待后端的消息关闭
ws . value &&
ws . value . close ( {
code : 1000 ,
reason : '挂断' ,
complete : ( ) => {
console . log ( '挂断Ws' ) ;
wsStatus . value = false ;
}
} ) ;
}
stopAudioRecord ( ) ; // 关掉录音
if ( isOutStatus . value !== '03' || errrStatus === 'networkError' ) { // 转文字时候不关遮罩层,网络错误必须关遮罩层
if ( isOutStatus . value !== '03' || errrStatus === 'networkError' ) {
// 转文字时候不关遮罩层,网络错误必须关遮罩层
popupRef . value . close ( ) ;
// 关掉弹窗后的提示
if ( errrStatus === 'networkError' ) {
return showErrorTip ( ErrorCode . NetworkError )
} else if ( isOutStatus . value !== '02' && recordDurationMs <= 1200 ) { // 取消的时候,不校验最低时间
return showErrorTip ( ErrorCode . ShortRecord )
if ( errrStatus === 'networkError' ) {
return showErrorTip ( ErrorCode . NetworkError ) ;
} else if ( isOutStatus . value !== '02' && recordDurationMs <= 1200 ) {
// 取消的时候,不校验最低时间
return showErrorTip ( ErrorCode . ShortRecord ) ;
}
}
if ( isOutStatus . value === '01' && status . value == 'voice_send_ing' ) {
emit ( 'sendLoading' , { recordId : recordId . value } )
if ( isOutStatus . value === '01' && status . value == 'voice_send_ing' ) {
emit ( 'sendLoading' , { recordId : recordId . value } ) ;
// 如果socket长时间没有返回,这里兜底一下
setTimeout ( ( ) => {
if ( status . value === 'default' ) return ;
status . value = 'default' ; // 恢复成默认状态
emit ( 'submitVoice' , { ossKey : '' , text : '' , recordId : recordId . value } ) ;
} , 5000 )
}
} ;
const stopRecord = async ( errrStatus = '' ) => {
clearTimeout ( pressTimer . value ) ;
if ( ! isRecording . value ) return ; // 未处于录音状态
const _isOutStatus = ( props . mode === 'text-only' && isOutStatus . value === '01' ) ? "03" : isOutStatus . value ;
console . log ( '_isOutStatus' , _isOutStatus ) ;
// 拖动到转文字按钮上抬手或者仅文字模式的发送也强行算他转文字
if ( _isOutStatus === '03' ) {
status . value = 'voice_to_text' ; //主状态设置为转文字
voice _to _text _status . value = 'init' ;
} else if ( _isOutStatus === '01' ) {
status . value = 'voice_send_ing' ; //主状态设置为语音发送中
}
if ( [ '01' , '03' ] . includes ( _isOutStatus ) ) {
// 向后端发送抬手动作
ws . value &&
ws . value . send ( {
data : ProtocolCodec . pack ( MessageType . CONTROL _CMD , { type : ControlCode . FRONT _TO _SERVER _OVER } )
} ) ;
}
const recordDurationMs = Date . now ( ) - recordStartTime . value ;
if ( _isOutStatus !== '02' ) {
// 取消的时候,不校验最低时间
// 核心:计算录音总时长(毫秒转秒,保留1位小数)
if ( recordDurationMs < 600 ) {
await new Promise < void > ( ( resolve ) => {
setTimeout ( ( ) => {
resolve ( ) ;
} , 600 - recordDurationMs ) ;
} ) ;
}
}
isRecording . value = false ;
if ( _isOutStatus === '02' || errrStatus === 'networkError' ) {
// 取消的时候自己主动关闭websocket,其他的时候需要等待后端的消息关闭
ws . value &&
ws . value . close ( {
code : 1000 ,
reason : '挂断' ,
complete : ( ) => {
console . log ( '挂断Ws' ) ;
wsStatus . value = false ;
}
} ) ;
}
stopAudioRecord ( ) ; // 关掉录音
if ( _isOutStatus !== '03' || errrStatus === 'networkError' ) {
// 转文字时候不关遮罩层,网络错误必须关遮罩层
popupRef . value . close ( ) ;
// 关掉弹窗后的提示
if ( errrStatus === 'networkError' ) {
return showErrorTip ( ErrorCode . NetworkError ) ;
} else if ( _isOutStatus !== '02' && recordDurationMs <= 1200 ) {
// 取消的时候,不校验最低时间
return showErrorTip ( ErrorCode . ShortRecord ) ;
}
}
if ( _isOutStatus === '01' && status . value == 'voice_send_ing' ) {
emit ( 'sendLoading' , { recordId : recordId . value } ) ;
// 如果socket长时间没有返回,这里兜底一下
setTimeout ( ( ) => {
if ( status . value === 'default' ) return ;
status . value = 'default' ; // 恢复成默认状态
emit ( 'submitVoice' , { ossKey : '' , text : '' , recordId : recordId . value } ) ;
} , 5000 )
}
} ;
// 发送文本
const showKeyboard = ( ) => {
@@ -349,29 +476,30 @@
isInputVisible . value = ! isInputVisible . value ;
}
} ;
// 切换键盘语音
const changeBtn = ( ) => {
if ( props . isDisabled ) return ;
isInputVisible . value = ! isInputVisible . value ;
inputText . value = '' ;
} ;
// 禁用时点击给的提示
const disabled _click = ( ) => {
console . log ( '禁用时点击给的提示' ) ;
if ( props . isDisabled ) common . msg ( props . disabledText ) ;
} ;
const send _msg = ( ) => {
console . log ( '点击发送' ) ;
}
setupKeyboardHeightListener ( ( height : number ) => {
const _height = Math . max ( height - 100 , 0 )
pageBoxMarginBottom . value = ` ${ _height } px ` ;
} ;
setupKeyboardHeightListener ( ( height : number ) => {
const _height = Math . max ( height - 100 , 0 ) ;
pageBoxMarginBottom . value = ` ${ _height } px ` ;
} ) ;
// 外面调用放弃这次
const give _up = ( ) => {
console . log ( '调用结束语音回答' ) ;
@@ -379,19 +507,17 @@
} ;
// 外部调用,清理输入框数据
const clearinputText = ( text = '' ) => {
const clearInputText = ( text = '' ) => {
const old _text = inputText . value ;
inputText . value = text ;
return old _text ;
} ;
defineExpose ( { clearinputText , give _up } ) ;
defineExpose ( { clearInputText , give _up } ) ;
< / script >
< style lang = "scss" scoped >
@ import " ./style/index.scss" ;
@ import " ./style/popup.scss" ;
@ import ' ./style/index.scss' ;
@ import ' ./style/popup.scss' ;
. white - bg - box {
height : 365 rpx ;
@@ -420,8 +546,7 @@
}
}
: : v - deep . uv - input _ _content _ _field - wrapper _ _field {
padding - right : 60 rpx ;
}
< / style >
< / style >