# v-model 修飾符 (2-4) ###### tags: `Vue`、`2. 指令語法全介紹` 2022.3.2 ### Lazy   資料不會同步鍵入,只會在輸入完按確認才會同步。 ``` {{ lazyMsg }} <input type="text" class="form-control" v-model.lazy="lazyMsg"> ``` ### Number   一般v-model輸入資料都一律視為字串,唯有加上number修飾符,輸入數字資料才會轉為數字格式。 ``` {{ numberMsg }}{{ typeof numberMsg }} <input type="number" class="form-control" v-model.number="numberMsg"> ``` ### Trim   過濾掉輸入文字的前後空白,實務上信箱輸入會使用到。 ``` 這是一段{{ trimMsg }}緊黏的文字 <input type="text" class="form-control" v-model.trim="trimMsg"> ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up