input.uvue 14.0 KB
Newer Older
Y
init  
yurj26 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323









































































































    export default {
        data() {
            return {
                title: 'input',
                focus: false,
                inputValue: '',
                showClearIcon: false,
                inputClearValue: '',
                changeValue: '',
                showPassword: true
            }
        },
        methods: {
            onKeyInput: function (event : InputEvent) {
                this.inputValue = event.detail.value
            },
            replaceInput: function (event : InputEvent) {
                var value = event.detail.value;
                if (value == '11') {
                    this.changeValue = '2';
                }
            },
            clearInput: function(event: InputEvent) {
                this.inputClearValue = event.detail.value;
                if (event.detail.value.length > 0) {
                    this.showClearIcon = true;
                } else {
                    this.showClearIcon = false;
                }
            },
            clearIcon: function() {
                this.inputClearValue = '';
                this.showClearIcon = false;
            },
            changePassword: function() {
                this.showPassword = !this.showPassword;
            },
            // hideKeyboard: function(event: InputEvent) {
            //     if (event.detail.value === '123') {
            //         uni.hideKeyboard();
            //     }
            // },
            // onFocus() {
            //     this.$mp.page.$getAppWebview().setStyle({
            //         softinputNavBar: 'none'
            //     })
            // },
            // onBlur() {
            //     this.$mp.page.$getAppWebview().setStyle({
            //         softinputNavBar: 'auto'
            //     })
            // }
        }
    }


const GenPagesComponentInputInputStyles = [new Map<string, Map<string, Map<string, any>>>([["common-page-head", new Map<string, any>([["", new Map<string, any>([["paddingTop", "35rpx"], ["paddingRight", "35rpx"], ["paddingBottom", "35rpx"], ["paddingLeft", "35rpx"], ["flexDirection", "row"], ["justifyContent", "center"]])]])], ["common-page-head-title-box", new Map<string, any>([["", new Map<string, any>([["paddingTop", 0], ["paddingRight", "40rpx"], ["paddingBottom", 0], ["paddingLeft", "40rpx"], ["height", "88rpx"], ["borderBottomWidth", "2rpx"], ["borderBottomStyle", "solid"], ["borderBottomColor", "#D8D8D8"]])]])], ["common-page-head-title", new Map<string, any>([["", new Map<string, any>([["lineHeight", "88rpx"], ["fontSize", "30rpx"], ["color", "#BEBEBE"]])]])], ["nvue-page-root", new Map<string, any>([["", new Map<string, any>([["backgroundColor", "#F8F8F8"], ["paddingBottom", 20]])]])], ["title", new Map<string, any>([["", new Map<string, any>([["paddingTop", 5], ["paddingRight", 13], ["paddingBottom", 5], ["paddingLeft", 13]])]])], ["uni-form-item__title", new Map<string, any>([["", new Map<string, any>([["fontSize", 16], ["lineHeight", 24]])]])], ["uni-input-wrapper", new Map<string, any>([["", new Map<string, any>([["display", "flex"], ["paddingTop", 8], ["paddingRight", 13], ["paddingBottom", 8], ["paddingLeft", 13], ["flexDirection", "row"], ["flexWrap", "nowrap"], ["backgroundColor", "#FFFFFF"]])]])], ["uni-input", new Map<string, any>([["", new Map<string, any>([["height", 28], ["lineHeight", 28], ["fontSize", 15], ["paddingTop", 0], ["paddingRight", 0], ["paddingBottom", 0], ["paddingLeft", 0], ["flex", "1"], ["backgroundColor", "#FFFFFF"]])]])], ["uni-icon", new Map<string, any>([["", new Map<string, any>([["width", 24], ["height", 24]])]])]])]
@Suppress("UNUSED_PARAMETER") function GenPagesComponentInputInputRender(_ctx: GenPagesComponentInputInput): VNode | null {
const _component_page_head = resolveComponent("page-head")

  return createElementVNode("view", new Map<string, any | null>([["class", "nvue-page-root"]]), [
    createVNode(_component_page_head, new Map<string, any | null>([["title", _ctx.title]]), null, 8 /* PROPS */, ["title"]),
    createElementVNode("view", new Map<string, any | null>([["class", "uni-common-mt"]]), [
      createCommentVNode(" <view class=\"uni-form-item uni-column\">\n                <view class=\"title\"><text class=\"uni-form-item__title\">可自动聚焦的 input</text></view>\n                <view class=\"uni-input-wrapper\">\n                    <input class=\"uni-input\" :focus=\"true\" placeholder=\"自动获得焦点\" ref=\"input\"/>\n                </view>\n            </view> "),
      createCommentVNode(" <view v-if=\"platform==='ios'&&!isNvue\" class=\"uni-form-item uni-column\">\n                <view class=\"title\"><text class=\"uni-form-item__title\">隐藏 iOS 软键盘上的导航条</text></view>\n                <view class=\"uni-input-wrapper\">\n                    <input class=\"uni-input\" placeholder=\"触摸其他地方收起键盘\" @focus=\"onFocus\" @blur=\"onBlur\" />\n                </view>\n            </view> "),
      createElementVNode("view", new Map<string, any | null>([["class", "uni-form-item uni-column"]]), [
        createElementVNode("view", new Map<string, any | null>([["class", "title"]]), [
          createElementVNode("text", new Map<string, any | null>([["class", "uni-form-item__title"]]), "键盘右下角按钮显示为搜索")
        ]),
        createElementVNode("view", new Map<string, any | null>([["class", "uni-input-wrapper"]]), [
          createElementVNode("input", new Map<string, any | null>([
            ["class", "uni-input"],
            ["confirmType", "search"],
            ["placeholder", "键盘右下角按钮显示为搜索"]
          ]))
        ])
      ]),
      createElementVNode("view", new Map<string, any | null>([["class", "uni-form-item uni-column"]]), [
        createElementVNode("view", new Map<string, any | null>([["class", "title"]]), [
          createElementVNode("text", new Map<string, any | null>([["class", "uni-form-item__title"]]), "键盘右下角按钮显示为发送")
        ]),
        createElementVNode("view", new Map<string, any | null>([["class", "uni-input-wrapper"]]), [
          createElementVNode("input", new Map<string, any | null>([
            ["class", "uni-input"],
            ["confirmType", "send"],
            ["placeholder", "键盘右下角按钮显示为发送"]
          ]))
        ])
      ]),
      createElementVNode("view", new Map<string, any | null>([["class", "uni-form-item uni-column"]]), [
        createElementVNode("view", new Map<string, any | null>([["class", "title"]]), [
          createElementVNode("text", new Map<string, any | null>([["class", "uni-form-item__title"]]), "控制最大输入长度的 input")
        ]),
        createElementVNode("view", new Map<string, any | null>([["class", "uni-input-wrapper"]]), [
          createElementVNode("input", new Map<string, any | null>([
            ["class", "uni-input"],
            ["maxlength", 10],
            ["placeholder", "最大输入长度为10"]
          ]))
        ])
      ]),
      createElementVNode("view", new Map<string, any | null>([["class", "uni-form-item uni-column"]]), [
        createElementVNode("view", new Map<string, any | null>([["class", "title"]]), [
          createElementVNode("text", new Map<string, any | null>([["class", "uni-form-item__title"]]), "实时获取输入值:" + toDisplayString(_ctx.inputValue), 1 /* TEXT */)
        ]),
        createElementVNode("view", new Map<string, any | null>([["class", "uni-input-wrapper"]]), [
          createElementVNode("input", new Map<string, any | null>([
            ["class", "uni-input"],
            ["onInput", _ctx.onKeyInput],
            ["placeholder", "输入同步到view中"]
          ]), null, 40 /* PROPS, HYDRATE_EVENTS */, ["onInput"])
        ])
      ]),
      createElementVNode("view", new Map<string, any | null>([["class", "uni-form-item uni-column"]]), [
        createElementVNode("view", new Map<string, any | null>([["class", "title"]]), [
          createElementVNode("text", new Map<string, any | null>([["class", "uni-form-item__title"]]), "控制输入的 input")
        ]),
        createElementVNode("view", new Map<string, any | null>([["class", "uni-input-wrapper"]]), [
          createElementVNode("input", new Map<string, any | null>([
            ["class", "uni-input"],
            ["onInput", _ctx.replaceInput],
            ["value", _ctx.changeValue],
            ["placeholder", "连续的两个1会变成2"]
          ]), null, 40 /* PROPS, HYDRATE_EVENTS */, ["onInput", "value"])
        ])
      ]),
      createCommentVNode(" <view class=\"uni-form-item uni-column\">\n                <view class=\"title\"><text class=\"uni-form-item__title\">控制键盘的 input</text></view>\n                <view class=\"uni-input-wrapper\">\n                    <input class=\"uni-input\" ref=\"input1\" @input=\"hideKeyboard\" placeholder=\"输入123自动收起键盘\" />\n                </view>\n            </view> "),
      createElementVNode("view", new Map<string, any | null>([["class", "uni-form-item uni-column"]]), [
        createElementVNode("view", new Map<string, any | null>([["class", "title"]]), [
          createElementVNode("text", new Map<string, any | null>([["class", "uni-form-item__title"]]), "数字输入的 input")
        ]),
        createElementVNode("view", new Map<string, any | null>([["class", "uni-input-wrapper"]]), [
          createElementVNode("input", new Map<string, any | null>([
            ["class", "uni-input"],
            ["type", "number"],
            ["placeholder", "这是一个数字输入框"]
          ]))
        ])
      ]),
      createElementVNode("view", new Map<string, any | null>([["class", "uni-form-item uni-column"]]), [
        createElementVNode("view", new Map<string, any | null>([["class", "title"]]), [
          createElementVNode("text", new Map<string, any | null>([["class", "uni-form-item__title"]]), "密码输入的 input")
        ]),
        createElementVNode("view", new Map<string, any | null>([["class", "uni-input-wrapper"]]), [
          createElementVNode("input", new Map<string, any | null>([
            ["class", "uni-input"],
            ["password", true],
            ["type", "text"],
            ["placeholder", "这是一个密码输入框"]
          ]))
        ])
      ]),
      createElementVNode("view", new Map<string, any | null>([["class", "uni-form-item uni-column"]]), [
        createElementVNode("view", new Map<string, any | null>([["class", "title"]]), [
          createElementVNode("text", new Map<string, any | null>([["class", "uni-form-item__title"]]), "带小数点的 input")
        ]),
        createElementVNode("view", new Map<string, any | null>([["class", "uni-input-wrapper"]]), [
          createElementVNode("input", new Map<string, any | null>([
            ["class", "uni-input"],
            ["type", "digit"],
            ["placeholder", "带小数点的数字键盘"]
          ]))
        ])
      ]),
      createCommentVNode(" <view class=\"uni-form-item uni-column\">\n                <view class=\"title\"><text class=\"uni-form-item__title\">身份证输入的 input</text></view>\n                <view class=\"uni-input-wrapper\">\n                    <input class=\"uni-input\" type=\"idcard\" placeholder=\"身份证输入键盘\" /> </view>\n            </view> "),
      createElementVNode("view", new Map<string, any | null>([["class", "uni-form-item uni-column"]]), [
        createElementVNode("view", new Map<string, any | null>([["class", "title"]]), [
          createElementVNode("text", new Map<string, any | null>([["class", "uni-form-item__title"]]), "控制占位符颜色的 input")
        ]),
        createElementVNode("view", new Map<string, any | null>([["class", "uni-input-wrapper"]]), [
          createElementVNode("input", new Map<string, any | null>([
            ["class", "uni-input"],
            ["placeholder-style", "color:#F76260"],
            ["placeholder", "占位符字体是红色的"]
          ]))
        ])
      ]),
      createElementVNode("view", new Map<string, any | null>([["class", "uni-form-item uni-column"]]), [
        createElementVNode("view", new Map<string, any | null>([["class", "title"]]), [
          createElementVNode("text", new Map<string, any | null>([["class", "uni-form-item__title"]]), "带清除按钮的输入框")
        ]),
        createElementVNode("view", new Map<string, any | null>([["class", "uni-input-wrapper"]]), [
          createElementVNode("input", new Map<string, any | null>([
            ["class", "uni-input"],
            ["placeholder", "带清除按钮的输入框"],
            ["value", _ctx.inputClearValue],
            ["onInput", _ctx.clearInput]
          ]), null, 40 /* PROPS, HYDRATE_EVENTS */, ["value", "onInput"]),
          isTrue(_ctx.showClearIcon)
            ? createElementVNode("image", new Map<string, any | null>([
                ["key", 0],
                ["class", "uni-icon"],
                ["src", "/static/icons/clear.png"],
                ["onClick", _ctx.clearIcon]
              ]), null, 8 /* PROPS */, ["onClick"])
            : createCommentVNode("v-if", true)
        ])
      ]),
      createElementVNode("view", new Map<string, any | null>([["class", "uni-form-item uni-column"]]), [
        createElementVNode("view", new Map<string, any | null>([["class", "title"]]), [
          createElementVNode("text", new Map<string, any | null>([["class", "uni-form-item__title"]]), "可查看密码的输入框")
        ]),
        createElementVNode("view", new Map<string, any | null>([["class", "uni-input-wrapper"]]), [
          createElementVNode("input", new Map<string, any | null>([
            ["class", "uni-input"],
            ["placeholder", "请输入密码"],
            ["password", _ctx.showPassword]
          ]), null, 8 /* PROPS */, ["password"]),
          createElementVNode("image", new Map<string, any | null>([
            ["class", "uni-icon"],
            ["src", !_ctx.showPassword ? '/static/icons/eye-active.png': '/static/icons/eye.png'],
            ["onClick", _ctx.changePassword]
          ]), null, 8 /* PROPS */, ["src", "onClick"])
        ])
      ])
    ])
  ])
}