輸入框輸入有誤時顯示紅色邊框

2021-09-11 07:50:04 字數 755 閱讀 8871

達到目的:list選擇,顯示1-5條引數,每條引數輸入時檢測輸入是否有誤,輸入有誤則方框變紅,且頁面顯示報錯

最開始在網上找到的方法便是獲取id,然後改變屬性,但是此種方式比較適合少量的確定的div或其他型別,但是這裡的list列表至少10條以上,每條的引數名稱和數量不盡相同。

通過v-bind切換class,bool[index]為true則開啟class,結合v-for,可以實現目的

// an highlighted block

"width: 200px;margin-left:5px;" v-model=

"querytype" slot=

"prepend"

class

="filter-item" @change=

"changepara"

>

for=

"(item,index) in list"

:key=

"index"

:value=

"item.value"

:label=

"item.label"

>

<

/el-option>

<

/el-select>

"paramodel[index]" style=

"width: 180px;" v-bind:

class=""

>

<

/el-input>

輸入框輸入限制

public class verifytext 主監聽 regexpverifylistener regexpverifylistener null regexpverifylistener regexpverifylistener this.text.getdata digitverifylist...

輸入框輸入金額

用法 第一種 inputfilter filters edshopprice.setfilters filters edmarketprice.setfilters filters 第二種 edshopprice.setfilters new inputfilter edmarketprice.se...

輸入框只能輸入數字

正規表示式限制輸入框只能輸入數字 如下 其中,onafterpaste防止使用者從其它地方copy內容貼上到輸入框 輸入框只能輸入字母和下橫線的正規表示式 輸入框只能輸入字母數字和下橫線的正規表示式 或 as3 文字過濾 過濾文字輸入 textfield.restrict 此處為可輸入的內容 fie...