#author("2022-09-13T12:52:26+08:00","default:Admin","Admin")
#author("2022-09-26T17:44:13+08:00","default:Admin","Admin")
[[Vue]]

&color(red){※前提条件:本文基于 Vue 2.0 创作};
#contents

* 输入限制 [#h794d2c3]

只可以输入数值
#codeprettify{{
<el-input v-model.number="form.age"/>

或者
<el-input
v-model="form.age"
oninput="value=value.replace(/[^\d]/g,'')"
/>
}}

对输入的字符串去掉前后空格
#codeprettify{{
<el-input v-model.trim="xxxx"> 
}}

* 动态Style [#ef8a0df2]

html

#codeprettify{{
<el-table-column prop="note" label="备注">
  <template slot-scope="scope">
    <el-input
      type="textarea"
      :autosize="{ minRows: 1, maxRows: 5 }"
      placeholder="无"
      v-model="scope.row.note"
      :class="textareaNote"
      readonly
    >
    </el-input>
  </template>
</el-table-column>
}}

javascript

#codeprettify{{
data(){
  return {
    textareaNote:'textareaNote',
  }
}
}}

css
#codeprettify{{
<style>
.textareaNote > textarea {
  border: none !important;
  font-size: 12;
  font-family: 'Microsoft YaHei';
}
</style>
}}

* 监听是否有修改 [#hbf09978]

使用 input 事件

#codeprettify{{
<el-input v-model="scope.row.number" @input="handlerNgcountChange(scope.row)" />
}}

#hr();
コメント:
#comment_kcaptcha

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS