2022年7月22日 星期五

輸入方塊設定唯讀但可接受輸入資料

<b-form-input readonly id="輸入" v-on:keyup="輸入($event)" v-model="單號"></b-form-input>

輸入(event) {
            if (this.單號==null) this.單號 = '';
             if (event.key == 'Backspace') this.單號 = this.單號.left(this.單號.length - 1);
            else if (event.key != 'Enter') this.單號 += event.key;
},

先設定焦點,然後鍵盤輸入時可接收輸入資料,於手機上可避免跳出輸入鍵盤,適用於搭配相機或透過電腦接上掃描器掃條碼的情境

沒有留言:

自訂權限驗證機制

// 使用 filter [Route("api/[controller]")] [ApiController] [Authorize] [TypeFilter(typeof(CustomAsyncAuthorizationFilter))] public c...