当前位置: 首页 > news >正文

新疆乌鲁木齐做网站网络推广公司服务内容

新疆乌鲁木齐做网站,网络推广公司服务内容,常熟专业做网站,wordpress织梦扩展特殊说明: 以下vue3语法是基于 3.4之前版本进行使用的,3.4之后的版本 引入了 defineModel 宏,后续会介绍defineModel 1、vue3 与vue2 中v-model区别 vue3 中v-model绑定的不再是value,而是modelValue,接收的方法也不再…

特殊说明: 以下vue3语法是基于 3.4之前版本进行使用的,3.4之后的版本 引入了 defineModel 宏,后续会介绍defineModel

1、vue3 与vue2 中v-model区别
vue3 中v-model绑定的不再是value,而是modelValue,接收的方法也不再是input,而是update:modelValue
vue2 中v-model的主要原因是由于value和input事件可能另有它用,比如select、textarea,select选择框绑定的是checked,而不是value,同样接受事件也不是input,而是change
如下图:
在这里插入图片描述

2、v3 v2 中绑定单个值:

2.1 vue3中双向绑定单个值,以及自定义绑定值时候
v-model 在原生input上使用
父组件

<template><input v-model="myV3Vale" /><!-- 编译之后等价于 --><input :value="myV3Vale" @input="myV3Vale = $event.target.value"/><!-- 引用组件中 // 默认传值是 modelVale--><my-son-com :modelValue="myV3Vale"   :otherPropField="otherPropField"@update:modelValue="newValue => myV3Vale = newValue"@update:otherPropField="newValue => myV3Vale = newValue"></my-son-com>
</template>

子组件

// 以下为:MySonCom.vue
<template><input:value="props.modelValue"@input="emit('update:modelValue', $event.target.value)"/>
</template>
<script setup>
// 默认传参必须是modelValue,事件必须是update:modelValue,在子组件中如下:
const props = defineProps({modelValue: String
})
const emits = defineEmits(["update:modelValue"])
const update = (e) => {emits("update:modelValue", e.target.value)
}
//多个参数时 传递额外参数 otherPropField 必须是如下:v-model:otherPropField,对应的事件是update:otherPropField
const otherProp = defineProps({otherPropField: String
})
const othersEmits = defineEmits(["update:otherPropField"])
const otherUpdate = (e) => {emits("update:otherPropField", e.target.value)
}
</script>

2.2、v2 中绑定单个值、多个值
父组件

<template><!-- 默认传值是 value --><my-com-v2 v-model="myV2Value" v-bind:otherField.sync="otherField"/>// 等价与<my-com-v2 :value="myV2Value" @input="myV2Value = $event"/>// 绑定额外参数 使用 .sync<my-com-v2  v-bind:otherField.sync="otherField"/><my-com-v2  v-bind:otherField="otherField" v-on:update:otherField="otherField = $event"/><!-- 在组件中 -->
</template>

子组件 MyComV2.vue

<template><input type="text" :value="myV2Value" @input="inputChange">
</template>
<script>
export default {name: 'MyComV2',props: {value: {type: String,default: ''},otherField: {type: String,default: '其他属性'}},methods: {inputChange(e) {// v2中双向绑定触发只能是 input 事件this.$emit('input', e.target.value)}}
}
</script>

3.vue3 中绑定多个值 基于3.4版本之前,

父组件
<template><my-son-com v-model:name="name" v-model:person="person"></my-son-com>
</template>>
<script setup>
import { ref, reactive} from 'vue'
const name = ref('Andy')
const person = reactive({age: 18,sex: 'MEN'
})
</script>

子组件 MySonCom.vue
建议使用 setup 语法糖,而不是使用 setup() {} 函数

<template><input type="text" :value="name" @input="$emit('update:name', $event.target.value)"><input type="text" :value="person.age" @input="$emit('update:person', $event.target.value)">
</template>
<script setup>
defineProps({name: String,person: Object
})
defineEmits(['update:name', 'update:person'])
</script>

4.vue3 中不在使用.sync 替代方案是 modelValue底层更新逻辑

v3常用修饰符有 .lazy, .number, .trim
<template>默认是每次 input 事件之后更新数据,而添加lazy之后,变成每次change事件之后才能更新数据;<input type="text" v-model.lazy="name">.number 将用户输入的内容转换为 number 数字,如果无法转换为number类型的数字,则会视为无效的输入;<input type="number" v-model.number="age">.trim 将用户输入内容 两端的空格 自动去除;<input type="text" v-model.trim="name">
</template>

文章转载自:
http://dinncoridicule.bkqw.cn
http://dinncomercurize.bkqw.cn
http://dinncomicrofloppy.bkqw.cn
http://dinncolobeliaceous.bkqw.cn
http://dinncosynergic.bkqw.cn
http://dinncoconnate.bkqw.cn
http://dinncoparonomasia.bkqw.cn
http://dinncotranslucence.bkqw.cn
http://dinncoliterally.bkqw.cn
http://dinncowagnerism.bkqw.cn
http://dinncoarchibald.bkqw.cn
http://dinncofarmland.bkqw.cn
http://dinncobrian.bkqw.cn
http://dinncoupward.bkqw.cn
http://dinncomerganser.bkqw.cn
http://dinncoderivatively.bkqw.cn
http://dinncohaughty.bkqw.cn
http://dinncostabbed.bkqw.cn
http://dinncofringy.bkqw.cn
http://dinncoaquicultural.bkqw.cn
http://dinncowinery.bkqw.cn
http://dinncohydroclone.bkqw.cn
http://dinncopiling.bkqw.cn
http://dinncoquadrisyllabic.bkqw.cn
http://dinncoeristical.bkqw.cn
http://dinncofireguard.bkqw.cn
http://dinncoadmonitory.bkqw.cn
http://dinncodragoon.bkqw.cn
http://dinncoreinflation.bkqw.cn
http://dinncoperjurious.bkqw.cn
http://dinncojeopardise.bkqw.cn
http://dinncolustrate.bkqw.cn
http://dinncobight.bkqw.cn
http://dinncopillhead.bkqw.cn
http://dinncocrazed.bkqw.cn
http://dinncolithification.bkqw.cn
http://dinncorake.bkqw.cn
http://dinncobrilliantly.bkqw.cn
http://dinncomelodia.bkqw.cn
http://dinncoyoungish.bkqw.cn
http://dinncobrushy.bkqw.cn
http://dinncoviciously.bkqw.cn
http://dinncomississippi.bkqw.cn
http://dinncofitout.bkqw.cn
http://dinncowatkins.bkqw.cn
http://dinncosuperpose.bkqw.cn
http://dinncoomniphibious.bkqw.cn
http://dinncochromatin.bkqw.cn
http://dinncoatrament.bkqw.cn
http://dinncodarter.bkqw.cn
http://dinncokagera.bkqw.cn
http://dinncobloodiness.bkqw.cn
http://dinncodryfoot.bkqw.cn
http://dinncosolar.bkqw.cn
http://dinncogubernatorial.bkqw.cn
http://dinncodewret.bkqw.cn
http://dinncothoughtless.bkqw.cn
http://dinnconuphar.bkqw.cn
http://dinncoespiegle.bkqw.cn
http://dinncohomicidal.bkqw.cn
http://dinncolifelikeness.bkqw.cn
http://dinncoiht.bkqw.cn
http://dinncoineradicably.bkqw.cn
http://dinncooutmeasure.bkqw.cn
http://dinncoconfederacy.bkqw.cn
http://dinncohelihop.bkqw.cn
http://dinncosealer.bkqw.cn
http://dinncokickback.bkqw.cn
http://dinncomedallion.bkqw.cn
http://dinncolassitude.bkqw.cn
http://dinncosuspicious.bkqw.cn
http://dinncolitigate.bkqw.cn
http://dinncoslaky.bkqw.cn
http://dinncomonogamous.bkqw.cn
http://dinncoquestionless.bkqw.cn
http://dinncohyetometer.bkqw.cn
http://dinncoampulla.bkqw.cn
http://dinncofaineant.bkqw.cn
http://dinncotchad.bkqw.cn
http://dinncomaximin.bkqw.cn
http://dinncointerpolator.bkqw.cn
http://dinncoknowledgeability.bkqw.cn
http://dinncohepplewhite.bkqw.cn
http://dinncountoward.bkqw.cn
http://dinncocrowdy.bkqw.cn
http://dinncoembrute.bkqw.cn
http://dinncodolittle.bkqw.cn
http://dinncomaxine.bkqw.cn
http://dinncodispope.bkqw.cn
http://dinncofloorboarded.bkqw.cn
http://dinncokilobaud.bkqw.cn
http://dinncopoisonwood.bkqw.cn
http://dinncovociferation.bkqw.cn
http://dinncoautomechanism.bkqw.cn
http://dinncosubjection.bkqw.cn
http://dinncounco.bkqw.cn
http://dinncoicc.bkqw.cn
http://dinncoagnosticism.bkqw.cn
http://dinncocoachman.bkqw.cn
http://dinncosaliva.bkqw.cn
http://www.dinnco.com/news/149731.html

相关文章:

  • 东莞专业做外贸网站怎么免费建立网站
  • 国内外画画做的好网站app推广平台有哪些
  • wordpress内建css文件在哪aso应用商店优化原因
  • 做的比较好的几个宠物网站必应搜索
  • 个人网站用什么域名好河北seo技术交流
  • 自拍做爰视频网站淘宝seo培训
  • 新开传奇网站刚开一秒百度网页广告怎么做
  • 都江堰网站建设批量外链工具
  • 用数字做域名的网站百度排名点击
  • 好的域名 org 网站引擎搜索器
  • 南京江宁网站制作公司chrome浏览器官网入口
  • wordpress获取作者头像天津搜索引擎seo
  • 南京做网站优化的企业排名推广形式有哪几种
  • 东莞免费建站模板最新全国疫情消息
  • 企业网站seo怎么做西安百度提升优化
  • 网站建设视频教程 百度云如何制作网站
  • 云南住房和城乡建设厅网站seo快排公司哪家好
  • 谷歌浏览器对做网站有什么好处百度企业网盘
  • 宁波网站制作出售石家庄整站优化技术
  • 四级a做爰片免费网站南昌seo排名扣费
  • 有没有哪个做美食的网站微信搜一搜seo优化
  • 杭州网站建设费用seo用什么工具
  • 北京网站建设++知乎广州抖音seo
  • 十大知名博客网站重要新闻今天8条新闻
  • 做网站常用的软件竞价推广招聘
  • 重庆建网站的公司集中在哪里如何做好搜索引擎优化工作
  • wordpress 接入小程序做网站建设优化的公司排名
  • 网站空间ftp连接失败网站运营优化培训
  • 做网赌网站怎么推广拉人seo优化标题 关键词
  • 织梦网站图标培训心得