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

做羞羞的事情网站凡科网域名续费

做羞羞的事情网站,凡科网域名续费,做平台网站需要多少钱,网站权重查询接口1、自定义组件#xff0c;并使用 v-model 进行数据双向绑定。 简述#xff1a; 自定义组件使用 v-model 进行传参时#xff0c;遵循 Vue 3 的 v-model 机制。在 Vue 3 中#xff0c;v-model 默认使用了 modelValue 作为 prop 名称#xff0c;以及 update:modelValue 作为…1、自定义组件并使用 v-model 进行数据双向绑定。 简述 自定义组件使用 v-model 进行传参时遵循 Vue 3 的 v-model 机制。在 Vue 3 中v-model 默认使用了 modelValue 作为 prop 名称以及 update:modelValue 作为事件名称。 例子 首先我们创建一个自定义组件 MyInput.vue该组件使用 script setup 语法并允许通过 v-model 绑定值 !-- MyInput.vue -- template input :valuemodelValue inputupdateValue / /template script setup import { defineProps, defineEmits, ref } from vue; const props defineProps({ modelValue: String }); const emit defineEmits([update:modelValue]); const updateValue (event) { emit(update:modelValue, event.target.value); }; /script在这个例子中使用了 defineProps 来定义 modelValue prop它对应于 v-model 绑定的值。同时我们使用 defineEmits 来声明 update:modelValue 事件该事件将在输入框的值变化时被触发。 接下来在父组件中使用这个自定义组件并通过 v-model 绑定一个数据属性 !-- ParentComponent.vue -- template div pValue in Parent: {{ inputValue }}/p MyInput v-modelinputValue / /div /template script setup import { ref } from vue; import MyInput from ./MyInput.vue; const inputValue ref(); /script在父组件中导入了自定义的 MyInput 组件并使用 v-model 将 inputValue 绑定到该组件的 modelValue prop 上。当 MyInput 组件中的输入框值变化时它会触发 update:modelValue 事件进而更新父组件中的 inputValue。 注意在 script setup 中不需要显式地返回任何东西给模板因为所有的响应式状态通过 ref 或 reactive 创建和函数都会自动暴露给模板。这使得代码更加简洁和直观。 2、异步加载动态组件 ├─ src │ ├─ components │ │ ├─ ChartA.vue │ │ ├─ ChartB.vue │ │ └─ ChartC.vue │ └─ test-async.vue └─ package.json 异步加载组件 方式一 templateAsyncOne / /templatescript setup import { defineAsyncComponent } from vue;const AsyncOne defineAsyncComponent(() import(/components/ChartA.vue) ); /script方法二vue3vite5 中 templateAsyncTwo/ /templatescript setup import { defineAsyncComponent, ref } from vue;const AsyncTwo ref(null); AsyncTwo.value registerComponent(/ChartC);// 使用异步组件的方式加载组件 const registerComponent (componentPath) {const modules import.meta.glob(./components/**/*.{vue,tsx});for (const item in modules) {if (item.includes(componentPath)) {return defineAsyncComponent(modules[item]);}} }; /script异步加载动态组件 templatediv v-for(item, index) in componentsInfo :keyindexcomponent :isitem.loadComp //div /templatescript setup import { defineAsyncComponent, onMounted, ref } from vue;const componentsInfo ref([{id: 1-1,title: 图表A,component: /ChartA,},{id: 1-2,title: 图表B,component: /ChartB,},{id: 1-3,title: 图表C,component: /ChartC,}, ]);onMounted(() {processLoad(componentsInfo.value); });const processLoad (info) {for (let i 0; i info.length; i) {let item info[i];if (!item.component) {continue;}let resComp registerComponent(item.component);item.loadComp resComp;} };// 注册一个异步组件 const registerComponent (componentPath) {//获取 src/components 文件夹下所有组件const modules import.meta.glob(./components/**/*.{vue,tsx}); for (const item in modules) {if (item.includes(componentPath)) {return defineAsyncComponent(modules[item]);}} }; /script效果 3、
http://www.dnsts.com.cn/news/81523.html

相关文章:

  • 网站参考页面设计优化方案数学必修二答案
  • 网站建设讲解材料WordPress魔方格子
  • 怎么建设一个优秀的网站西安公司
  • 在线黑科技网站中国工商做年报网站
  • 电影订票网站开发如何制作网页代码
  • 个旧建设局信息公开门户网站详情页设计制作
  • 个人网站建设心得体会龙华和龙岗哪个繁华
  • 合肥 电子商务 网站建设网站建设前端工具
  • 餐饮公司做网站好处西安企业网站seo
  • 营销型网站建设设计如何查网站备案号
  • 坪地网站建设效果南通网站开发价格
  • 晋城市公用事业建设局网站cn域名续费多少钱一年
  • 电子商务网站建设维护实训报告feed wordpress
  • 非遗网站建设目的厦门网站关键词优化
  • 物流网站建设策划书上海opencart网站建设
  • 常熟网站建设icp备案系统开发板价格
  • 网站建设服务费税率多少淘宝官方网站登录页面
  • 开发一个网站平台多少钱人力资源外包灵活用工
  • 网站搭建实训总结哈尔滨建设厅官方网站
  • 国外儿童社区网站模板湖南微网站营销
  • 网站备案的是空间还是域名手机怎么登pc端智慧团建
  • 网站建设解决方案ppt模板app 网站建设
  • 东莞网站高端建设网站升级改版需要几天
  • wordpress 免费电商主题站长工具推荐seo综合查询
  • 苏州网站公司如何做公众号微信推广
  • 酒店类网站建设开发书织梦cms侵权开庭
  • 做电商看的网站有哪些地方信息网站源码
  • 建网站卖虚拟资源需要怎么做如何建立一家公司
  • wordpress注册修改怎样优化自己的网站
  • 商城网站要多少钱wordpress app 加载慢