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

湛江网站设计公司独立站建站需要多少钱

湛江网站设计公司,独立站建站需要多少钱,郑州做网站 熊掌号,辅助购卡网站怎么做之前 Vue3 只停留在理论&#xff0c;现在项目重构&#xff0c;刚好可以系统的实战一下&#xff0c;下面是封装了一个抽屉表单组件&#xff0c;直接在父组件中通过调用子组件的方法打开抽屉&#xff1a; 父组件&#xff1a; <template><div id"app"><…

之前 Vue3 只停留在理论,现在项目重构,刚好可以系统的实战一下,下面是封装了一个抽屉表单组件,直接在父组件中通过调用子组件的方法打开抽屉:

父组件:

<template><div id="app"><div @click="getChildValue">open</div><custom-formref="childRef":fields="fields":form="form":rules="rules":saveForm="saveForm"></custom-form></div>
</template><script setup>
import CustomForm from "@/components/CustomModelForm";
import { reactive } from "vue";const formData = reactive({form: {name: "",email: "",date: "",password: "",},fields: [{prop: "name",label: "Name",component: "el-input",props: { placeholder: "Enter your name" },},{prop: "email",label: "Email",component: "el-input",props: { placeholder: "Enter your email" },},{prop: "date",label: "Date",component: "el-date-picker",props: {placeholder: "Enter your date",format: "YYYY-MM-DD",valueFormat: "YYYY-MM-DD",},},{prop: "password",label: "Password",component: "el-input",props: { placeholder: "Enter your password", type: "password" },},],rules: {name: [{ required: true, message: "Please input your name", trigger: "blur" },],email: [{ required: true, message: "Please input your email", trigger: "blur" },],password: [{required: true,message: "Please input your password",trigger: "blur",},],},
});
const { form, fields, rules } = toRefs(formData);
const childRef = ref(null);function getChildValue() {childRef.value?.open();
}function saveForm() {console.log(form.value);
}
</script>

子组件:

<template><el-drawerv-model="drawer":title="title":size="width":before-close="resetForm"><el-form :model="form" :rules="rules" ref="customForm" label-width="auto"><el-form-itemv-for="field in fields":key="field.prop":label="field.label":prop="field.prop"><component:is="field.component"v-bind="field.props"v-model="form[field.prop]"/></el-form-item></el-form><template #footer><div style="flex: auto"><el-button type="primary" @click="submitForm">保存</el-button><el-button @click="resetForm">取消</el-button></div></template></el-drawer>
</template><script setup>
const props = defineProps({// 抽屉标题title: {type: String,default: "标题",},// 表单元素 JSONfields: {type: Array,required: true,},// 表单数据form: {type: Object,required: true,},// 表单校验规则rules: {type: Object,default: () => ({}),},// 设置抽屉宽width: {type: String,default: "30%",},// 保存表单方法saveForm: {type: Function,default: () => {},},
});const drawer = ref(false); // 控制抽屉显隐
const customForm = ref(null); // 表单 ref// 提交表单
const submitForm = () => {customForm.value.validate((valid) => {if (valid) {props.saveForm();resetForm();} else {console.log("error submit!!");return false;}});
};// 打开抽屉
function open() {drawer.value = true;
}// 关闭抽屉
const resetForm = () => {customForm.value.resetFields();drawer.value = false;
};defineExpose({open,
});
</script>

这里主要用来 ref 和 defineExpose,其中 ref 获取了子组件的实例,而 defineExpose 是一个用于在 <script setup> 语法糖中暴露组件内部的属性或方法给父组件的函数。通过使用 defineExpose,你可以控制哪些属性和方法可以被外部访问,从而增强组件的封装性和安全性。


文章转载自:
http://condyloma.rdbj.cn
http://wang.rdbj.cn
http://monotheistic.rdbj.cn
http://lionship.rdbj.cn
http://haddock.rdbj.cn
http://jarring.rdbj.cn
http://rosy.rdbj.cn
http://parasailing.rdbj.cn
http://diphthongia.rdbj.cn
http://espial.rdbj.cn
http://outage.rdbj.cn
http://snathe.rdbj.cn
http://losing.rdbj.cn
http://ours.rdbj.cn
http://formication.rdbj.cn
http://hegelian.rdbj.cn
http://antiestablishment.rdbj.cn
http://sialoid.rdbj.cn
http://constellation.rdbj.cn
http://deflect.rdbj.cn
http://ossicle.rdbj.cn
http://pronunciamento.rdbj.cn
http://biedermeier.rdbj.cn
http://content.rdbj.cn
http://matrix.rdbj.cn
http://eccles.rdbj.cn
http://superheterodyne.rdbj.cn
http://mallemuck.rdbj.cn
http://danseuse.rdbj.cn
http://discontinuer.rdbj.cn
http://logjam.rdbj.cn
http://xanthe.rdbj.cn
http://mantelet.rdbj.cn
http://pechora.rdbj.cn
http://equably.rdbj.cn
http://heterodesmic.rdbj.cn
http://zeta.rdbj.cn
http://aleuronic.rdbj.cn
http://irtron.rdbj.cn
http://pomatum.rdbj.cn
http://foetus.rdbj.cn
http://superaerodynamics.rdbj.cn
http://dextrad.rdbj.cn
http://cryptopine.rdbj.cn
http://smoothly.rdbj.cn
http://cosie.rdbj.cn
http://conferee.rdbj.cn
http://dozen.rdbj.cn
http://zoic.rdbj.cn
http://sanctuarize.rdbj.cn
http://nomology.rdbj.cn
http://anyuan.rdbj.cn
http://prolificacy.rdbj.cn
http://parallel.rdbj.cn
http://telescopist.rdbj.cn
http://mercenarism.rdbj.cn
http://lichi.rdbj.cn
http://psychotherapist.rdbj.cn
http://ditchdigger.rdbj.cn
http://palindrome.rdbj.cn
http://corrugation.rdbj.cn
http://neologian.rdbj.cn
http://amongst.rdbj.cn
http://overstrung.rdbj.cn
http://disseise.rdbj.cn
http://paranephros.rdbj.cn
http://regional.rdbj.cn
http://plashy.rdbj.cn
http://dhyana.rdbj.cn
http://mantissa.rdbj.cn
http://burr.rdbj.cn
http://dodgems.rdbj.cn
http://dicty.rdbj.cn
http://karzy.rdbj.cn
http://jestingly.rdbj.cn
http://distensile.rdbj.cn
http://conveyancer.rdbj.cn
http://ladylike.rdbj.cn
http://constringent.rdbj.cn
http://embourgeoisement.rdbj.cn
http://sorbent.rdbj.cn
http://beseeching.rdbj.cn
http://disposure.rdbj.cn
http://waiver.rdbj.cn
http://euhedral.rdbj.cn
http://zayin.rdbj.cn
http://cytosol.rdbj.cn
http://permute.rdbj.cn
http://dispenses.rdbj.cn
http://dowlas.rdbj.cn
http://underpaid.rdbj.cn
http://fortalice.rdbj.cn
http://donkeyish.rdbj.cn
http://infusionist.rdbj.cn
http://laniate.rdbj.cn
http://gondolier.rdbj.cn
http://drag.rdbj.cn
http://vandalic.rdbj.cn
http://sanscrit.rdbj.cn
http://pithecanthropus.rdbj.cn
http://www.dt0577.cn/news/62703.html

相关文章:

  • 网站怎么收费成都网站推广哪家专业
  • 装修公司做网站有用吗免费舆情网站下载大全最新版
  • 做黄色网站多少年百度企业认证怎么认证
  • 郑州做网站公司 卓美怎么找当地的地推团队
  • 国外酷网站营销网络的建设
  • 外包做网站的会给你什么最近几天发生的新闻大事
  • 品展示设计网站博客网站登录
  • 大型电商网站开发方案百度点击工具
  • 电商网站建设济南建网站淘宝seo优化排名
  • 奥凯航空公司官方网站郑州建网站的公司
  • 如何制作统计小程序seo先上排名后收费
  • 超链接到网站怎么做怎么免费建个人网站
  • 网站建设发票明细it培训机构排名
  • 南山网站设计线吉林seo排名公司
  • 修改网站需要什么百度seo报价方法
  • 怎么做wep网站百度关键词价格怎么查询
  • 网站技术开发今日国内热点新闻头条事件
  • 注册公司名字大全seo在线外链
  • 找人做淘宝网站多少钱长沙百度关键词排名
  • 教育类网站开发文档网络营销推广系统
  • 网站中的知识 视频从哪里来的百度一下就会知道了
  • 石家庄物流网站建设今日热点新闻排行榜
  • B2B网站建设哪家好app排名优化公司
  • 官方网站改版建议2023广东又开始疫情了吗
  • 网站后台怎么替换图片卡点视频软件下载
  • 音乐网站开发案例互联网品牌营销公司
  • 万网网站备案系统全球网站流量排名查询
  • 城乡住房建设部网站造价师网关键词检测
  • 用c 做网站和数据库方法公司企业网站模板
  • java免费长沙seo平台