# 输入框(Input box)

用于信息输入的页面、弹窗等。

# 示例

<template>
  <div class="wrapper">
    <dof-minibar title="4.10 输入框"></dof-minibar>
    <div class="title-box">
      <text class="title-text">基础用法</text>
    </div>
    <scroller class="scroller">
      <dof-input :isShowClear="true" v-model="value1" :placeholder="'请输入设备型号或系列'"></dof-input>
      <dof-input class="m-t-32" v-model="value2" :placeholder="'请输入设备型号或系列'"></dof-input>
      <div class="content">
        <dof-input :borderRadius="16" v-model="value2" :placeholder="'请输入验证码'"></dof-input>
        <dof-input :borderRadius="16" class="m-t-16" v-model="value3" :placeholder="'请输入验证码'"></dof-input>
        <dof-input :borderRadius="16" class="m-t-16" v-model="value2" :placeholder="'请输入验证码'">
          <text class="reset" slot="right">重新获取</text>
        </dof-input>
        <dof-input :borderRadius="16" class="m-t-16" v-model="value2" :placeholder="'请输入验证码'">
          <text class="second" slot="right">60s</text>
        </dof-input>
        <dof-input
          :borderRadius="16"
          class="m-t-16"
          :type="type"
          v-model="value4"
          :placeholder="'请输入验证码'"
          :isShowPWDIcon="true"
        ></dof-input>
      </div>
    </scroller>
  </div>
</template>

<style scoped>
.wrapper {
  background-color: #f9f9f9;
}
.title-box {
  padding: 32px;
  background-color: #e5e5e8;
}
.title-text {
  font-family: PingFangSC-Medium;
  font-size: 36px;
  color: #000000;
  font-weight: 500;
}
.scroller {
  padding-top: 40px;
  padding-bottom: 100px;
}
.m-t-16 {
  margin-top: 16px;
}
.m-t-32 {
  margin-top: 32px;
}
.content {
  padding: 42px 32px;
}
.reset {
  font-family: PingFangSC-Regular;
  font-size: 32px;
  color: #b35336;
}
.second {
  font-family: PingFangSC-Regular;
  font-size: 32px;
  color: rgba(255, 255, 255, 0.4);
}

@media screen and (weex-theme: colmo) {
  .wrapper {
    background-color: #151617;
  }
}
</style>

<script>
import { DofMinibar, DofInput, DofIconfont } from 'dolphin-weex-ui'
export default {
  components: { DofMinibar, DofInput, DofIconfont },
  data: () => ({
    value1: '请输入设备型号或系列',
    value2: '',
    value3: '已输入',
    value4: '',
    type: 'password'
  }),
  computed: {
    passwordIcon() {
      return this.type === 'password' ? '\u4768' : '\u4769'
    }
  },
  created() {},
  methods: {
    handleClick() {
      if (this.type === 'password') {
        this.type = 'text'
      } else {
        this.type = 'password'
      }
    }
  }
}
</script>

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
点我扫二维码 查看demo

# Attributes

Prop Type Required Default Description
value String Y '' input value值
placeholder String N '' input 填充文本
type String N text input类型,text/number/password/tel等 参考weex input类型
autofocus Boolean N false input是否自动获得焦点
maxlength Number N - input 最大输入长度
bgColor String N '' input 背景颜色
height Number N 0 input 高度
isShowClear Boolean N false 是否显示清除按钮
isShowPWDIcon Boolean N false 是否显示密码图标
borderRadius String N '' input 圆角半径

# Events

事件名 说明 回调参数
input input 输入事件 event
iconClick 图标点击事件 event
Last Updated: 12/19/2025, 10:27:53 AM