当前位置:网站首页>V-model principle and modifier
V-model principle and modifier
2022-07-19 01:38:00 【Still】
1. principle
<div id="app">
// v-model Equivalent to a set of two instructions (v-bind,v-on)
// input event : Used to monitor whether the user has entered something
<input type="text" :value="message" @input="valueChange">
<input type="text" :value="message" @input="message = $event.target.value">
// Change the value in the page console ,data The data in will not change
{
{
message}}
</div>
<script>
const app = new Vue({
el: '#app',
data: {
message: ' How are you? '
},
methods: {
valueChange(event) {
console.log("......")
// Get input
this.message = event.target.value
}
}
})
</script>
2. Modifier
// 1.lazy The function of the modifier : because v-model Two way binding , Change too often . add to lazy after , You can enter after the user completes the input , Change the data again
<input type="text" v-model.lazy="message">
// 2.number The function of the modifier
<input type="number" v-model.number="age">
// typeof Always show string type , because v-model The default binding string type
// So change it to the top v-model.number That's all right.
<h2>{
{
age}}——{
{
typeof age}}</h2>
// 3.trim Use of modifiers , Spaces are not allowed , The space on the left and right sides of the string , There can be spaces in the middle
<input type="number" v-model.trim="age">
边栏推荐
- 小程序嵌入网页向小程序跳转并传参,微信小程序中实现公众号授权获取openId
- Text indent in uniapp doesn't work, and the indentation in the first line of uniapp doesn't work. How to solve it?
- Raw Socket抓包,某些端口的数据包抓不到
- jsx 编译
- computed和watch、watchEffect
- How to modify the color of a line of text in the elemtnui table (elemtnui table modifies the color of a line of text)
- 二分法查找
- Vue项目部署,清理缓存
- 服务器如何安装宝塔面板?(宝塔面板安装教程)
- Determine whether the two timestamps are the same day
猜你喜欢

Summary of Applied Cryptography

JS replaces a character in the string, and JS modifies the specified character in the string

使用bat自动执行cmd命令(多个命令或单个命令)
![[AHU2021校内赛] ez-injection](/img/44/644c27f86cbbc9c6630249d2111066.png)
[AHU2021校内赛] ez-injection

网站被黑,通过百度/搜狗等搜索关键词访问跳转到其他网站怎么办?

Common mode attack and shared prime of RSA

Cento7安装mysql5.5以及升级5.7

Deployment of cobalstrike (with resources)

NodeJS 跨域 CORS

Summary of XML external entity injection (xxE target recurrence)
随机推荐
object-fit:cover;在小程序中不起作用,小程序图片变形了如何处理
js获取一个文件名的后缀格式
Uni app wechat applet - Mall (4) - merchants
Nodejs cross domain CORS
uni-app微信小程序——商城(4)——商家
ES6 syntax -- Deconstruction assignment
Deployment of cobalstrike (with resources)
jsx 编译
红日安全靶场3
软件漏洞分析入门(四)
Determine whether the two timestamps are the same day
Computed and watch, watcheffect
服务器如何安装宝塔面板?(宝塔面板安装教程)
uni-app微信公众号(5)——新增、修改地址
JS intercepts the first few digits of the string or the last few digits of the string
Solve the flashing of the menu switch at the bottom of applet customization
01_模板语法
js替换字符串某个字符,js修改字符串中指定字符
Uni block button multiple clicks button multiple clicks
tp-watermark.js网页添加水印插件