提交 32372c01 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test(input): 移除 type digit 测试

上级 83ed9254
...@@ -210,55 +210,4 @@ describe('component-native-input', () => { ...@@ -210,55 +210,4 @@ describe('component-native-input', () => {
const input2 = await page.$('#both-model-value'); const input2 = await page.$('#both-model-value');
expect(await input2.value()).toEqual("123") expect(await input2.value()).toEqual("123")
}) })
it('digit input .', async () => { });
// ios 非 webview 模式规避该测试
// ios input type='digit' 输入 . 实际得到 。,只有系统软键盘才可以输入 .
if(isIos && !process.env.UNI_AUTOMATOR_APP_WEBVIEW){
return
}
await page.setData({
focus: false,
digitValue: '1'
})
await program.pageScrollTo(0)
const digitInput = await page.$('#uni-input-type-digit')
expect(await digitInput.value()).toEqual('1')
if (isAndroid) {
if (platformInfo.indexOf('6') != -1 && platformInfo.indexOf('x86') == -1) {
await program.tap({
x: 200,
y: 850,
})
} else if (platformInfo.indexOf('12') != -1) {
await program.tap({
x: 200,
y: 1500,
})
} else {
await program.tap({
x: 200,
y: 1200,
})
}
} else if (isIos) {
await program.tap({
x: 200,
y: 450,
})
} else {
await program.tap({
x: 200,
y: 400,
})
}
await page.waitFor(1000)
await program.keyboardInput('.2')
await page.waitFor(500)
await program.tap({
x: 0,
y: 0,
})
await page.waitFor(500)
expect(await digitInput.value()).toEqual('1.2');
})
});
<template> <template>
<!-- #ifdef APP --> <!-- #ifdef APP -->
<scroll-view style="flex: 1"> <scroll-view style="flex: 1">
<!-- #endif --> <!-- #endif -->
<page-head :title="title"></page-head> <page-head :title="title"></page-head>
<view class="uni-common-mt uni-padding-wrap"> <view class="uni-common-mt uni-padding-wrap">
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">设置输入框的初始内容</text> <text class="uni-title-text">设置输入框的初始内容</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-default" class="uni-input" value="hello uni-app x" /> <input id="uni-input-default" class="uni-input" value="hello uni-app x" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">type取值(不同输入法表现可能不一致)</text> <text class="uni-title-text">type取值(不同输入法表现可能不一致)</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-type-text" class="uni-input" type="text" placeholder="文本输入键盘" /> <input id="uni-input-type-text" class="uni-input" type="text" placeholder="文本输入键盘" />
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-type-number" class="uni-input" type="number" placeholder="数字输入键盘" /> <input id="uni-input-type-number" class="uni-input" type="number" placeholder="数字输入键盘" />
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-type-digit" class="uni-input" type="digit" placeholder="带小数点的数字输入键盘" v-model="digitValue" /> <input id="uni-input-type-digit" class="uni-input" type="digit" placeholder="带小数点的数字输入键盘" />
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-type-tel" class="uni-input" :type="inputTypeTel" placeholder="电话输入键盘" /> <input id="uni-input-type-tel" class="uni-input" :type="inputTypeTel" placeholder="电话输入键盘" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">密码输入框</text> <text class="uni-title-text">密码输入框</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-password" class="uni-input" :password="inputPassword" :value="inputPasswordValue" /> <input id="uni-input-password" class="uni-input" :password="inputPassword" :value="inputPasswordValue" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">无value设置的密码输入框</text> <text class="uni-title-text">无value设置的密码输入框</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" :password="true"/> <input class="uni-input" :password="true" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">占位符样式</text> <text class="uni-title-text">占位符样式</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-placeholder1" class="uni-input" :placeholder-style="inputPlaceHolderStyle" <input id="uni-input-placeholder1" class="uni-input" :placeholder-style="inputPlaceHolderStyle"
placeholder="占位符文字颜色为红色" /> placeholder="占位符文字颜色为红色" />
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-placeholder2" class="uni-input" :placeholder-class="inputPlaceHolderClass" <input id="uni-input-placeholder2" class="uni-input" :placeholder-class="inputPlaceHolderClass"
placeholder="占位符字体大小为10px" /> placeholder="占位符字体大小为10px" />
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" :placeholder-style="inputPlaceHolderStyle" <input class="uni-input" :placeholder-style="inputPlaceHolderStyle"
value="不设置placeholder只设置placeholder-style" /> value="不设置placeholder只设置placeholder-style" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">设置禁用输入框</text> <text class="uni-title-text">设置禁用输入框</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-disable" class="uni-input" :disabled="true"/> <input id="uni-input-disable" class="uni-input" :disabled="true" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">设置最大输入长度</text> <text class="uni-title-text">设置最大输入长度</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-maxlength" class="uni-input" :maxlength="10" placeholder="最大输入长度为10" <input id="uni-input-maxlength" class="uni-input" :maxlength="10" placeholder="最大输入长度为10"
:value="inputMaxLengthValue" @input="onMaxLengthInput" :focus="inputMaxLengthFocus" /> :value="inputMaxLengthValue" @input="onMaxLengthInput" :focus="inputMaxLengthFocus" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">设置光标与键盘的距离</text> <text class="uni-title-text">设置光标与键盘的距离</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" :cursor-spacing="1000" placeholder="光标与键盘的距离为1000px" /> <input class="uni-input" :cursor-spacing="1000" placeholder="光标与键盘的距离为1000px" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">自动获取焦点</text> <text class="uni-title-text">自动获取焦点</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-focus" class="uni-input" :focus="focus" <input id="uni-input-focus" class="uni-input" :focus="focus"
@keyboardheightchange="inputFocusKeyBoardChange" /> @keyboardheightchange="inputFocusKeyBoardChange" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">confirm-type取值(不同输入法表现可能不一致)</text> <text class="uni-title-text">confirm-type取值(不同输入法表现可能不一致)</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-confirm-send" class="uni-input" confirmType="send" placeholder="键盘右下角按钮显示为发送" /> <input id="uni-input-confirm-send" class="uni-input" confirmType="send" placeholder="键盘右下角按钮显示为发送" />
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-confirm-search" class="uni-input" confirmType="search" placeholder="键盘右下角按钮显示为搜索" /> <input id="uni-input-confirm-search" class="uni-input" confirmType="search" placeholder="键盘右下角按钮显示为搜索" />
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-confirm-next" class="uni-input" confirmType="next" placeholder="键盘右下角按钮显示为下一个" /> <input id="uni-input-confirm-next" class="uni-input" confirmType="next" placeholder="键盘右下角按钮显示为下一个" />
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-confirm-go" class="uni-input" confirmType="go" placeholder="键盘右下角按钮显示为前往" /> <input id="uni-input-confirm-go" class="uni-input" confirmType="go" placeholder="键盘右下角按钮显示为前往" />
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-confirm-done" class="uni-input" confirmType="done" placeholder="键盘右下角按钮显示为完成" /> <input id="uni-input-confirm-done" class="uni-input" confirmType="done" placeholder="键盘右下角按钮显示为完成" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">点击键盘右下角按钮时保持键盘不收起</text> <text class="uni-title-text">点击键盘右下角按钮时保持键盘不收起</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" :confirm-hold="true" /> <input class="uni-input" :confirm-hold="true" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title" @click="setCursor(4)"> <view class="uni-title" @click="setCursor(4)">
<text class="uni-title-text">设置输入框聚焦时光标的位置(点击生效)</text> <text class="uni-title-text">设置输入框聚焦时光标的位置(点击生效)</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input ref="input" class="uni-input" value="0123456789" :cursor="cursor" @blur="onCursorBlurChange"/> <input ref="input" class="uni-input" value="0123456789" :cursor="cursor" @blur="onCursorBlurChange" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title" @click="setSelection(0, 4)"> <view class="uni-title" @click="setSelection(0, 4)">
<text class="uni-title-text">设置输入框聚焦时光标的起始位置和结束位置(点击生效)</text> <text class="uni-title-text">设置输入框聚焦时光标的起始位置和结束位置(点击生效)</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input ref="input2" class="uni-input" value="0123456789" :selection-start="selectionStart" <input ref="input2" class="uni-input" value="0123456789" :selection-start="selectionStart"
:selection-end="selectionEnd" @blur="onSelectionBlurChange"/> :selection-end="selectionEnd" @blur="onSelectionBlurChange" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title" style="flex-direction: row;align-items: center;"> <view class="uni-title" style="flex-direction: row; align-items: center">
<text class="uni-title-text">设置光标颜色为红色</text> <text class="uni-title-text">设置光标颜色为红色</text>
<switch style="margin-left: 10px;" @change="changeCursorColor" :checked="cursor_color=='red'"></switch> <switch style="margin-left: 10px" @change="changeCursorColor" :checked="cursor_color == 'red'"></switch>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-cursor-color" class="uni-input" :cursor-color="cursor_color" value="光标颜色" /> <input id="uni-input-cursor-color" class="uni-input" :cursor-color="cursor_color" value="光标颜色" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">键盘弹起时,自动上推页面</text> <text class="uni-title-text">键盘弹起时,自动上推页面</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" :adjust-position="true" /> <input class="uni-input" :adjust-position="true" />
</view> </view>
</view> </view>
<view>
<view> <view class="uni-title" style="flex-direction: row; align-items: center">
<view class="uni-title" style="flex-direction: row;align-items: center;"> <text class="uni-title-text">设置hold-keyboard</text>
<text class="uni-title-text">设置hold-keyboard</text> <switch style="margin-left: 10px" @change="changeHoldKeyboard" :checked="holdKeyboard"></switch>
<switch style="margin-left: 10px;" @change="changeHoldKeyboard" :checked="holdKeyboard"></switch> </view>
</view> <view class="input-wrapper">
<view class="input-wrapper"> <input class="uni-input" :hold-keyboard="holdKeyboard" value="hold keyboard " />
<input class="uni-input" :hold-keyboard="holdKeyboard" value="hold keyboard " /> </view>
</view> </view>
</view>
<view>
<view class="uni-title">
<view> <text class="uni-title-text">input事件</text>
<view class="uni-title"> <text class="uni-subtitle-text" v-if="inputEventDetail">{{
<text class="uni-title-text">input事件</text> inputEventDetail
<text class="uni-subtitle-text" v-if="inputEventDetail">{{inputEventDetail}}</text> }}</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" @input="onInput" /> <input class="uni-input" @input="onInput" />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">focus事件和blur事件</text> <text class="uni-title-text">focus事件和blur事件</text>
<text class="uni-subtitle-text" v-if="focusAndBlurEventDetail">{{focusAndBlurEventDetail}}</text> <text class="uni-subtitle-text" v-if="focusAndBlurEventDetail">{{
</view> focusAndBlurEventDetail
<view class="input-wrapper"> }}</text>
<input class="uni-input" @focus="onFocus" @blur="onBlur" /> </view>
</view> <view class="input-wrapper">
</view> <input class="uni-input" @focus="onFocus" @blur="onBlur" />
</view>
<view> </view>
<view class="uni-title">
<text class="uni-title-text">confirm事件</text> <view>
<text class="uni-subtitle-text" v-if="confirmEventDetail">{{confirmEventDetail}}</text> <view class="uni-title">
</view> <text class="uni-title-text">confirm事件</text>
<view class="input-wrapper"> <text class="uni-subtitle-text" v-if="confirmEventDetail">{{
<input class="uni-input" @confirm="onConfirm" /> confirmEventDetail
</view> }}</text>
</view> </view>
<view class="input-wrapper">
<view> <input class="uni-input" @confirm="onConfirm" />
<view class="uni-title"> </view>
<text class="uni-title-text">keyboardheightchange事件</text> </view>
<text class="uni-subtitle-text"
v-if="keyboardHeightChangeEventDetail">{{keyboardHeightChangeEventDetail}}</text> <view>
</view> <view class="uni-title">
<view class="input-wrapper"> <text class="uni-title-text">keyboardheightchange事件</text>
<input class="uni-input" @keyboardheightchange="onKeyborardHeightChange" :focus="focusedForKeyboardHeightChangeTest"/> <text class="uni-subtitle-text"
</view> v-if="keyboardHeightChangeEventDetail">{{ keyboardHeightChangeEventDetail }}</text>
</view> </view>
<view class="input-wrapper">
<view> <input class="uni-input" @keyboardheightchange="onKeyborardHeightChange"
<view class="uni-title"> :focus="focusedForKeyboardHeightChangeTest" />
<text class="uni-title-text">带清除按钮的输入框</text> </view>
</view> </view>
<view class="input-wrapper">
<input class="uni-input" placeholder="带清除按钮的输入框" :value="inputClearValue" @input="clearInput" /> <view>
<image class="uni-icon" src="/static/icons/clear.png" v-if="showClearIcon" @click="clearIcon"> <view class="uni-title">
</image> <text class="uni-title-text">带清除按钮的输入框</text>
</view> </view>
</view> <view class="input-wrapper">
<input class="uni-input" placeholder="带清除按钮的输入框" :value="inputClearValue" @input="clearInput" />
<view> <image class="uni-icon" src="/static/icons/clear.png" v-if="showClearIcon" @click="clearIcon">
<view class="uni-title"> </image>
<text class="uni-title-text">可查看密码的输入框</text> </view>
</view> </view>
<view class="input-wrapper">
<input class="uni-input" placeholder="请输入密码" :password="showPassword" /> <view>
<image class="uni-icon" :src="!showPassword ? '/static/icons/eye-active.png' : '/static/icons/eye.png'" <view class="uni-title">
@click="changePassword"></image> <text class="uni-title-text">可查看密码的输入框</text>
</view> </view>
</view> <view class="input-wrapper">
<input class="uni-input" placeholder="请输入密码" :password="showPassword" />
<view> <image class="uni-icon" :src="
<view class="uni-title"> !showPassword
<text class="uni-title-text">同时存在 v-model 和 value</text> ? '/static/icons/eye-active.png'
</view> : '/static/icons/eye.png'
<view class="input-wrapper"> " @click="changePassword"></image>
<input id="both-model-value" class="uni-input" v-model='demoValue' value='456' /> </view>
</view>
</view>
</view> <view>
<view class="uni-title">
<view> <text class="uni-title-text">同时存在 v-model 和 value</text>
<view class="uni-title" style="flex-direction: row;align-items: center;"> </view>
<text class="uni-title-text">设置adjust-position</text> <view class="input-wrapper">
<switch style="margin-left: 10px;" @change="changeAdjustPosition" :checked="adjustPosition"></switch> <input id="both-model-value" class="uni-input" v-model="demoValue" value="456" />
</view> </view>
<view class="input-wrapper"> </view>
<input class="uni-input" :adjust-position="adjustPosition"/>
</view> <view>
</view> <view class="uni-title" style="flex-direction: row; align-items: center">
<text class="uni-title-text">设置adjust-position</text>
</view> <switch style="margin-left: 10px" @change="changeAdjustPosition" :checked="adjustPosition"></switch>
<!-- #ifdef APP --> </view>
</scroll-view> <view class="input-wrapper">
<!-- #endif --> <input class="uni-input" :adjust-position="adjustPosition" />
</template> </view>
<script lang="uts"> </view>
export default { </view>
data() { <!-- #ifdef APP -->
return { </scroll-view>
title: 'input', <!-- #endif -->
showClearIcon: false, </template>
inputClearValue: '', <script lang="uts">
showPassword: true, export default {
cursor: -1, data() {
cursor_color: "#3393E2", return {
selectionStart: -1, title: 'input',
selectionEnd: -1, showClearIcon: false,
inputEventDetail: '', inputClearValue: '',
focusAndBlurEventDetail: '', showPassword: true,
confirmEventDetail: '', cursor: -1,
keyboardHeightChangeEventDetail: '', cursor_color: "#3393E2",
focus: true, selectionStart: -1,
inputPassword: true, selectionEnd: -1,
inputTypeTel: "tel", inputEventDetail: '',
inputPlaceHolderStyle: "color:red", focusAndBlurEventDetail: '',
inputPlaceHolderClass: "uni-input-placeholder-class" as string.ClassString , confirmEventDetail: '',
inputMaxLengthValue: "", keyboardHeightChangeEventDetail: '',
onMaxLengthInputValue: "", focus: true,
inputMaxLengthFocus: false, inputPassword: true,
inputPasswordValue: "cipher", inputTypeTel: "tel",
inputFocusKeyBoardChangeValue: true, inputPlaceHolderStyle: "color:red",
holdKeyboard: false, inputPlaceHolderClass: "uni-input-placeholder-class" as string.ClassString,
keyboardHeight: 0, inputMaxLengthValue: "",
focusedForKeyboardHeightChangeTest: false, onMaxLengthInputValue: "",
demoValue: '123', inputMaxLengthFocus: false,
adjustPosition: false, inputPasswordValue: "cipher",
digitValue: '' inputFocusKeyBoardChangeValue: true,
} holdKeyboard: false,
}, keyboardHeight: 0,
methods: { focusedForKeyboardHeightChangeTest: false,
inputFocusKeyBoardChange(e : UniInputKeyboardHeightChangeEvent) { demoValue: '123',
this.inputFocusKeyBoardChangeValue = e.detail.height > 50 adjustPosition: false
}, }
onMaxLengthInput(event : UniInputEvent) { },
this.onMaxLengthInputValue = event.detail.value methods: {
}, inputFocusKeyBoardChange(e : UniInputKeyboardHeightChangeEvent) {
setCursor: function (cursor : number) { this.inputFocusKeyBoardChangeValue = e.detail.height > 50
(this.$refs['input'] as UniInputElement).focus(); },
this.cursor = cursor; onMaxLengthInput(event : UniInputEvent) {
}, this.onMaxLengthInputValue = event.detail.value
onCursorBlurChange(){ },
this.cursor = 0 setCursor: function (cursor : number) {
}, (this.$refs['input'] as UniInputElement).focus();
setSelection: function (selectionStart : number, selectionEnd : number) { this.cursor = cursor;
(this.$refs['input2'] as UniInputElement).focus(); },
this.selectionStart = selectionStart; onCursorBlurChange() {
this.selectionEnd = selectionEnd; this.cursor = 0
}, },
onSelectionBlurChange(){ setSelection: function (selectionStart : number, selectionEnd : number) {
this.selectionEnd = 0; (this.$refs['input2'] as UniInputElement).focus();
}, this.selectionStart = selectionStart;
clearInput: function (event : UniInputEvent) { this.selectionEnd = selectionEnd;
this.inputClearValue = event.detail.value },
if (event.detail.value.length > 0) { onSelectionBlurChange() {
this.showClearIcon = true this.selectionEnd = 0;
} else { },
this.showClearIcon = false clearInput: function (event : UniInputEvent) {
} this.inputClearValue = event.detail.value
}, if (event.detail.value.length > 0) {
clearIcon: function () { this.showClearIcon = true
this.inputClearValue = '' } else {
this.showClearIcon = false this.showClearIcon = false
}, }
changePassword: function () { },
this.showPassword = !this.showPassword clearIcon: function () {
}, this.inputClearValue = ''
onInput: function (event : UniInputEvent) { this.showClearIcon = false
console.log("键盘输入", JSON.stringify(event.detail)); },
this.inputEventDetail = JSON.stringify(event.detail) changePassword: function () {
}, this.showPassword = !this.showPassword
onFocus: function (event : UniInputFocusEvent) { },
console.log("输入框聚焦", JSON.stringify(event.detail)); onInput: function (event : UniInputEvent) {
this.focusAndBlurEventDetail = JSON.stringify(event.detail); console.log("键盘输入", JSON.stringify(event.detail));
}, this.inputEventDetail = JSON.stringify(event.detail)
onBlur: function (event : UniInputBlurEvent) { },
console.log("输入框失去焦点", JSON.stringify(event.detail)); onFocus: function (event : UniInputFocusEvent) {
this.focusAndBlurEventDetail = JSON.stringify(event.detail); console.log("输入框聚焦", JSON.stringify(event.detail));
}, this.focusAndBlurEventDetail = JSON.stringify(event.detail);
onConfirm: function (event : UniInputConfirmEvent) { },
console.log("点击完成按钮", JSON.stringify(event.detail)); onBlur: function (event : UniInputBlurEvent) {
this.confirmEventDetail = JSON.stringify(event.detail); console.log("输入框失去焦点", JSON.stringify(event.detail));
}, this.focusAndBlurEventDetail = JSON.stringify(event.detail);
onKeyborardHeightChange: function (event : UniInputKeyboardHeightChangeEvent) { },
console.log("键盘高度发生变化", JSON.stringify(event.detail)); onConfirm: function (event : UniInputConfirmEvent) {
this.keyboardHeightChangeEventDetail = JSON.stringify(event.detail); console.log("点击完成按钮", JSON.stringify(event.detail));
this.keyboardHeight = event.detail.height; this.confirmEventDetail = JSON.stringify(event.detail);
}, },
test_check_input_value() : number { onKeyborardHeightChange: function (event : UniInputKeyboardHeightChangeEvent) {
return this.onMaxLengthInputValue.length console.log("键盘高度发生变化", JSON.stringify(event.detail));
}, this.keyboardHeightChangeEventDetail = JSON.stringify(event.detail);
changeCursorColor(event : UniSwitchChangeEvent) { this.keyboardHeight = event.detail.height;
const checked = event.detail.value; },
if (checked) { test_check_input_value() : number {
this.cursor_color = "red" return this.onMaxLengthInputValue.length
} else { },
this.cursor_color = "#3393E2" changeCursorColor(event : UniSwitchChangeEvent) {
} const checked = event.detail.value;
const input = uni.getElementById<UniInputElement>("uni-input-cursor-color") if (checked) {
input?.focus() this.cursor_color = "red"
}, } else {
changeHoldKeyboard(event : UniSwitchChangeEvent) { this.cursor_color = "#3393E2"
const checked = event.detail.value; }
this.holdKeyboard = checked const input = uni.getElementById<UniInputElement>("uni-input-cursor-color")
}, input?.focus()
changeAdjustPosition(event : UniSwitchChangeEvent){ },
const checked = event.detail.value; changeHoldKeyboard(event : UniSwitchChangeEvent) {
this.adjustPosition = checked const checked = event.detail.value;
} this.holdKeyboard = checked
} },
} changeAdjustPosition(event : UniSwitchChangeEvent) {
</script> const checked = event.detail.value;
this.adjustPosition = checked
<style scoped> }
.input-wrapper { }
display: flex; }
padding: 8px 13px; </script>
margin: 5px 0;
flex-direction: row; <style scoped>
flex-wrap: nowrap; .input-wrapper {
background-color: #ffffff; display: flex;
} padding: 8px 13px;
margin: 5px 0;
.uni-input { flex-direction: row;
height: 28px; flex-wrap: nowrap;
font-size: 15px; background-color: #ffffff;
padding: 0px; }
flex: 1;
background-color: #ffffff; .uni-input {
} height: 28px;
font-size: 15px;
.uni-icon { padding: 0px;
width: 24px; flex: 1;
height: 24px; background-color: #ffffff;
} }
.uni-input-placeholder-class { .uni-icon {
font-size: 10px; width: 24px;
} height: 24px;
}
.uni-input-placeholder-class {
font-size: 10px;
}
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册