uview1.x文档的坑

97 阅读1分钟

因项目需要,需使用验证码的输入组件,正好uview有提供 u-message-input

根据文档的例子,在页面写了如下的代码: image.png

<u-message-input
  maxlength="6"
  :dot-fill="true"
  :focus="true"
  active-color="#aaa"
  inactive-color="#ccc"
/>

页面呈现的结果却不是6个盒子

image.png

对比文档给的例子,所以并没有怀疑maxlength的问题,而且参数表也明说了可以使用数字或字符串类型

image.png

最后发现,maxlength必须得用数字类型的才可以:

<u-message-input
  :maxlength="6"
  :dot-fill="true"
  :focus="true"
  active-color="#aaa"
  inactive-color="#ccc"
/>

image.png