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

新手学做网站书大型网站建设需要

新手学做网站书,大型网站建设需要,网站图片加载优化,网站 开发代码资源在这儿 ↑ vue之动态表单优化 vue2js动态表单优化vue3ts动态表单优化 vue2js动态表单优化 效果图 目录结构 五个文件的完整代码: 以下是App.vue templatedivrouter-view/router-viewFormpage //div /templa…代码资源在这儿 ↑ vue之动态表单优化 vue2js动态表单优化vue3ts动态表单优化 vue2js动态表单优化 效果图 目录结构 五个文件的完整代码: 以下是App.vue templatedivrouter-view/router-viewFormpage //div /templatescript import Formpage from ./views/FormPage.vue;export default {components: {Formpage}, } /script 以下是FormPage.vue templatediv classcontainerFormItemComp :formStateroot/FormItemComp/div /templatescript import FormItemComp from ../components/FormItemComp.vue; import root from ./FormPageDatas;export default {components: {FormItemComp},data() {return {root: root}} } /scriptstyle scoped .container {width: 80%;margin: 1em auto; } /style 以下是FormItemComp.vue templateel-formtemplate v-ifformStateel-form-item :labelformState.payload.labeltemplate v-ifformState.type inputel-input v-modelformState.payload.value//templatetemplate v-else-ifformState.type checkboxel-checkbox-group v-modelformState.payload.valueel-checkbox v-foroption in formState.payload.options :keyoption.value :labeloption.value{{ option.label }}/el-checkbox/el-checkbox-group/templatetemplate v-else-ifformState.type radioel-radio-group v-modelformState.payload.valueel-radio v-foroption in formState.payload.options :keyoption.value :labeloption.value{{ option.label }}/el-radio/el-radio-group/templatetemplate v-else-ifformState.type selectel-select v-modelformState.payload.valueel-option v-foroption in formState.payload.options :keyoption.value :labeloption.label :valueoption.value//el-select/template/el-form-itemFormItemComp :form-stategetNext()//template/el-form /templatescript export default {name: FormItemComp,props: {formState: {type: Object,default: null}},methods: {getNext() {let current this.formState;if (!current) {return null;}const ancestors [];ancestors.unshift(current);while ((current current.parent)) {ancestors.unshift(current);}return this.formState.next(this.formState, ancestors);}} } /scriptstyle scoped .el-form-item__label {padding-right: 10px !important; } /style 以下是FormItem.js import Vue from vue;/*** 创建表单项* param formItemType string 表单项的类型* param payload object 表单项的label、options、value* param next function 当前选择的值* param parent 上一个表当项* return {{next: ((function(*, *): (null|null))|*), parent: null, payload, type}}*/ export function createFormItem(formItemType, payload, next, parent) {if (!next) {next () null;}if (!parent) {parent null;}const nextFunc function(current, acients) {let nextItem next(current, acients);if (!nextItem) {return null;}nextItem.parent current;if (!Vue.observable(nextItem)) {nextItem Vue.observable(nextItem);}return nextItem;};return Vue.observable({type: formItemType,payload: payload,next: nextFunc,parent: parent,}); } 以下是FormPageDatas.js import {createFormItem} from /FormItem;const item1 createFormItem(select,{label: test1,options: [{label: test1-1, value: test1-1},{label: test1-2, value: test1-2},{label: test1-3, value: test1-3},],value: test1-1,},(current) {if (current.payload.value test1-2) {return item2;} else if (current.payload.value test1-3) {return item4;} else {return null;}} );const item2 createFormItem(input, {label: test2,value: test }, (current) (current.payload.value test2 ? item3 : null));const item3 createFormItem(checkbox,{label: test3,options: [{label: test3-1, value: test3-1},{label: test3-2, value: test3-2},{label: test3-3, value: test3-3},],value: [test3-2, test3-3],},(current) (current.payload.value.includes(test3-1) ? item4 : null) );const item4 createFormItem(radio, {label: test4,options: [{label: test4-1, value: test4-1},{label: test4-2, value: test4-2},{label: test4-3, value: test4-3},{label: test4-4, value: test4-4},],value: test4-4, });export default item1; vue3ts动态表单优化 效果图 目录结构 五个文件的完整代码: 以下是App.vue templatedivFormpage //div /templatescript setup langts import Formpage from ./views/Formpage.vue; /script 以下是FormPage.vue templatediv classcontainerFormItemComp :form-stateroot/FormItemComp/div /templatescript setup langts import FormItemComp from ../components/FormItemComp.vue; import root from ./FormPageDatas; /scriptstyle scoped .container {width: 80%;margin: 1em auto; } /style 以下是FormItemComp.vue templatetemplate v-ifformStatea-form-item :labelformState.payload.labeltemplate v-ifformState.type inputa-input v-model:valueformState.payload.value //templatetemplate v-else-ifformState.type checkboxa-checkbox-group v-model:valueformState.payload.valuea-checkbox v-foroption in formState.payload.options :valueoption.value{{ option.label }}/a-checkbox/a-checkbox-group/templatetemplate v-else-ifformState.type radioa-radio-group v-model:valueformState.payload.valuea-radio v-foroption in formState.payload.options :valueoption.value{{ option.label }}/a-radio/a-radio-group/templatetemplate v-else-ifformState.type selecta-select v-model:valueformState.payload.valuea-select-option v-foroption in formState.payload.options :valueoption.value{{ option.label }}/a-select-option/a-select/template/a-form-itemFormItemComp :form-stategetNext()/FormItemComp/template /templatescript setup langts import { FormItem } from ../FormItem;const props defineProps{formState: FormItem | null; }();function getNext(): FormItem | null {let current: FormItem | null props.formState;if (!current) {return null;}const acients [];acients.unshift(current);while ((current current.parent)) {acients.unshift(current);}return props.formState!.next(props.formState!, acients); } /scriptstyle .ant-form-item-label {padding-right: 10px !important; } /style 以下是FormItem.ts import { isReactive, reactive } from vue;export type FormItemType input | select | checkbox | radio;export interface FormItem {type: FormItemType;payload: any;next: (current: FormItem, acients: FormItem[]) FormItem | null;parent: FormItem | null; }export function createFormItem(formItemType: FormItem[type],payload: FormItem[payload],next?: FormItem[next],parent?: FormItem[parent] ): FormItem {if (!next) {next () null;}if (!parent) {parent null;}const nextFunc: FormItem[next] (current, acients) {let nextItem next!(current, acients);if (!nextItem) {return null;}nextItem.parent current;if (!isReactive(nextItem)) {nextItem reactive(nextItem);}return nextItem;};const formItem: FormItem reactive({type: formItemType,payload,next: nextFunc,parent,});return formItem; } 以下是FormPageDatas.ts import { createFormItem } from ../FormItem;const item1 createFormItem(select,{label: test1,options: [{ label: test1-1, value: test1-1 },{ label: test1-2, value: test1-2 },{ label: test1-3, value: test1-3 },],value: test1-1,},(current) {if (current.payload.value test1-2) {return item2;} else if (current.payload.value test1-3) {return item4;} else {return null;}} );const item2 createFormItem(input,{ label: test2, value: test },(current) (current.payload.value test2 ? item3 : null) );const item3 createFormItem(checkbox,{label: test3,options: [{ label: test3-1, value: test3-1 },{ label: test3-2, value: test3-2 },{ label: test3-3, value: test3-3 },],value: [test3-2, test3-3],},(current) (current.payload.value.includes(test3-1) ? item4 : null) );const item4 createFormItem(radio, {label: test4,options: [{ label: test4-1, value: test4-1 },{ label: test4-2, value: test4-2 },{ label: test4-3, value: test4-3 },{ label: test4-4, value: test4-4 },],value: test4-4, });export default item1;
http://www.dnsts.com.cn/news/13638.html

相关文章:

  • 怎样直接输入网址打开网站python制作网页
  • 哈尔滨网站建设信息品牌网站建设费用
  • 网站怎么做短信营销qq官方网站进入
  • 网站开发 制作阶段的说课稿重庆合川企业网站建设联系电话
  • 自己做婚恋网站合肥网站推广外包公司
  • 哈尔滨专业建网站方案建网站需要什么服务器
  • 临海建设局网站导航网络运营商自动选择
  • 网站开发网站开发公司哪家好合肥网站建设需要多少钱
  • iapp网站做软件电子政务网站建设的特点
  • 如何建设自己网站做内部优惠券网站赚钱吗
  • excel做公司的小网站seo深圳优化
  • 微信的微网站模板会员中心网站模板
  • 如何申请做网站编辑呢微信推广多少钱一次
  • 无锡建站模板系统app制作开发公司收费
  • 合肥培训网站建设c2m模式的电商平台有哪些
  • 女孩子学做网站有前途吗网站设计宽屏
  • 网站建设期末考试微信网站推广
  • 网站建设与推广方案模板邯郸网上房地产官网
  • 深圳营销型网站建设推广服务apache新建网站
  • 做网站下面会有小广告衣服定制app
  • 网站申请微信支付接口暖暖 视频 在线 观看 高清
  • 网站开发职能怎样做 云知梦 网站
  • wordpress的文章写好后无法访问seo新闻
  • 做校服的网站重庆招生官网
  • 怎么做一考试网站东莞免费公司网站建设
  • 太阳能灯网站建设石青网站推广软件
  • 公司网站制作站制作仲恺做网站
  • 网站搬家数据库配置天天外链官网
  • 深圳南园网站建设快速申请免费个人网站
  • 南阳市城乡和住房建设局网站seo托管