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

做ic贸易去什么网站好网站外围网站怎么做

做ic贸易去什么网站好,网站外围网站怎么做,深圳百度关键,基金网站模板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/158877.html

相关文章:

  • 做二手房的端口网站网站建设合同规定
  • 济南网站优化技术厂家中新生态城建设局门户网站
  • 买过域名之前就可以做网站了吗印度网站建设多少钱
  • 昆明网站建设哪家最好小程序开发一般采用的技术
  • 深圳市公司网站建设平台贵州企业网站建设公司
  • 建设网站公司推荐成都j网站制作
  • 网站风格确定网页设计动态效果
  • 湖南智能网站建设哪家好建网站公建网站公司
  • 佛山做网站企业济南网站制作公司报价
  • 做养生网站怎么赚钱织梦网站logo更改
  • 如何快速备案网站推广普通话写好规范字手抄报内容
  • 网站建设 自助建站百度手机网站制作
  • 自己怎么开网站东莞58同城网招聘
  • 网站制作首页网站建站建设的公司
  • 网站推广 2015谷歌新网wordpress域名解析
  • 新郑市网站建设定制开发wordpress文章版权声明
  • 2021年军事新闻昆明网站建设方案优化
  • 多语种网站建设方案张家港网站优化
  • 网站策划制作公司 北京wordpress由于插件无法登录
  • 用插件做网站学网页制作有什么用
  • 泉州网站设计哪家公司好广西智能网站建设设计
  • 商业网站的创建程序织梦怎么做单页网站
  • 50个单页面网站设计欣赏(2)开发网页多少钱
  • 网站建设问题调查网站策划界面效果感受心得
  • 百度网站关键字搜索怎么做小企业财务软件免费版
  • 西安个人做企业网站广州少儿编程培训机构
  • 海尔建设此网站的目的wordpress盈利模式
  • 网站本地可以打开广州网站开发棋牌
  • 门户网站微信服务号建设谷歌排名查询
  • 世界500强企业排名2023南京seo公司排名