提交 f77db297 编写于 作者: fxy060608's avatar fxy060608

chore: 调整 textarea 示例代码以同时支持web

上级 f401ca72
...@@ -12,7 +12,7 @@ export default { ...@@ -12,7 +12,7 @@ export default {
auto_focus_boolean: false, auto_focus_boolean: false,
default_value:"", default_value:"",
maxlength:-1, maxlength:-1,
inputmode_enum: [{"value":0,"name":"none"},{"value":1,"name":"text"},{"value":2,"name":"decimal"},{"value":3,"name":"numeric"},{"value":4,"name":"tel"},{"value":5,"name":"search"},{"value":6,"name":"email"},{"value":7,"name":"url"}] as ItemType[], inputmode_enum: [{"value":1,"name":"text"},{"value":2,"name":"decimal"},{"value":3,"name":"numeric"},{"value":4,"name":"tel"},{"value":5,"name":"search"},{"value":6,"name":"email"},{"value":7,"name":"url"},{"value":0,"name":"none"}] as ItemType[],
cursor_color: "#3393E2", cursor_color: "#3393E2",
inputmode_enum_current: 0 inputmode_enum_current: 0
} }
...@@ -46,45 +46,46 @@ export default { ...@@ -46,45 +46,46 @@ export default {
</script> </script>
<template> <template>
<view class="main"> <scroll-view style="flex: 1" :scroll-y="true">
<textarea <view class="main">
:value="default_value" <textarea
class="uni-textarea" :value="default_value"
:auto-focus="auto_focus_boolean" class="uni-textarea"
:focus="focus_boolean" :auto-focus="true"
:confirm-hold="confirm_hold_boolean" :focus="focus_boolean"
:auto-height="auto_height_boolean" :confirm-hold="confirm_hold_boolean"
:fixed="fixed_boolean" :auto-height="auto_height_boolean"
:show-confirm-bar="show_confirm_bar_boolean" :fixed="fixed_boolean"
:adjust-position="adjust_position_boolean" :show-confirm-bar="show_confirm_bar_boolean"
:cursor-color="cursor_color" :adjust-position="adjust_position_boolean"
:inputmode="inputmode_enum[inputmode_enum_current].name" :cursor-color="cursor_color"
:maxlength="maxlength" :inputmode="inputmode_enum[inputmode_enum_current].name"
@click="textarea_click" :maxlength="maxlength"
@touchstart="textarea_touchstart" @click="textarea_click"
@touchmove="textarea_touchmove" @touchstart="textarea_touchstart"
@touchcancel="textarea_touchcancel" @touchmove="textarea_touchmove"
@touchend="textarea_touchend" @touchcancel="textarea_touchcancel"
@tap="textarea_tap" @touchend="textarea_touchend"
@longpress="textarea_longpress" @tap="textarea_tap"
@confirm="textarea_confirm" @longpress="textarea_longpress"
@input="textarea_input" @confirm="textarea_confirm"
@linechange="textarea_linechange" @input="textarea_input"
@blur="textarea_blur" @linechange="textarea_linechange"
@keyboardheightchange="textarea_keyboardheightchange" @blur="textarea_blur"
@focus="textarea_focus" @keyboardheightchange="textarea_keyboardheightchange"
style="padding: 20rpx; border: 1px solid #666" @focus="textarea_focus"
/> style="padding: 20rpx; border: 1px solid #666"
</view> />
</view>
<scroll-view style="flex: 1" :scroll-y="true"> <view class="content">
<view class="content"> <!-- #ifndef WEB -->
<boolean-data <boolean-data
:defaultValue="false" :defaultValue="false"
title="键盘弹起时,是否自动上推页面" title="键盘弹起时,是否自动上推页面"
@change="change_adjust_position_boolean" @change="change_adjust_position_boolean"
></boolean-data> ></boolean-data>
<!-- #ifdef !APP --> <!-- #endif -->
<!-- #ifdef MP -->
<boolean-data <boolean-data
:defaultValue="false" :defaultValue="false"
title="是否显示键盘上方带有“完成”按钮那一栏" title="是否显示键盘上方带有“完成”按钮那一栏"
...@@ -112,27 +113,29 @@ export default { ...@@ -112,27 +113,29 @@ export default {
@change="change_focus_boolean" @change="change_focus_boolean"
></boolean-data> ></boolean-data>
<boolean-data <boolean-data
:defaultValue="false" :defaultValue="true"
title="自动获取焦点" title="首次自动获取焦点"
@change="change_auto_focus_boolean" @change="change_auto_focus_boolean"
></boolean-data> ></boolean-data>
<boolean-data <boolean-data
:defaultValue="false" :defaultValue="false"
title="改变光标颜色为透明" title="改变光标颜色为透明"
@change="change_cursor_color_boolean" @change="change_cursor_color_boolean"
></boolean-data> ></boolean-data>
<enum-data <!-- #ifdef WEB -->
:items="inputmode_enum" <enum-data
title="是一个枚举属性,它提供了用户在编辑元素或其内容时可能输入的数据类型的提示。在符合条件的高版本webview里,uni-app的 web 和 app-vue 平台中可使用本属性。" :items="inputmode_enum"
@change="radio_change_inputmode_enum" title="是一个枚举属性,它提供了用户在编辑元素或其内容时可能输入的数据类型的提示。在符合条件的高版本webview里,uni-app的 web 和 app-vue 平台中可使用本属性。"
></enum-data> @change="radio_change_inputmode_enum"
></enum-data>
<!-- #endif -->
</view> </view>
</scroll-view> </scroll-view>
</template> </template>
<style> <style>
.main { .main {
max-height: 500rpx; min-height: 200rpx;
padding: 10rpx 0; padding: 10rpx 0;
border-bottom: 1px solid rgba(0, 0, 0, 0.06); border-bottom: 1px solid rgba(0, 0, 0, 0.06);
flex-direction: row; flex-direction: row;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册