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

网站推广排名怎么做平潭县建设局网站

网站推广排名怎么做,平潭县建设局网站,建筑资料网站有哪些,做网站可以用什么软件😄 解锁前端表单数据的秘密旅程:从后端到用户选择!✨ 嘿,技术爱好者们!👋 你有没有在开发中遇到过这样的困惑:表单里的数据(比如图片附件、识别点 ID)从哪儿来的&#x…

😄 解锁前端表单数据的秘密旅程:从后端到用户选择!✨

嘿,技术爱好者们!👋 你有没有在开发中遇到过这样的困惑:表单里的数据(比如图片附件、识别点 ID)从哪儿来的?是后端偷偷塞给你的,还是用户辛勤上传的?🤔 今天,我们要一起踏上一场“数据探秘之旅”,以 compare-form.vue 为案例,揭开 imagesgenuineIdentificationPointIdsfakeIdentificationPointIds 这三个“宝藏”的来源秘密!🔍 准备好啦?带上你的好奇心,跟我走!🚀


🎬 开场:表单数据的“身世之谜”

想象一下,你打开 compare-form.vue,看到这样的表单组件:

<w-form-multiple-image v-model="form.images" label="图片附件" />
<w-form-select v-model="form.genuineIdentificationPointIds" :list="identifies1" />
<w-form-select v-model="form.fakeIdentificationPointIds" :list="identifies2" />

这些字段绑定了 form.images(图片数组)、genuineIdentificationPointIds(真货识别点 ID 数组)和 fakeIdentificationPointIds(假货识别点 ID 数组)。它们的数据从哪儿冒出来的?是魔法吗?🪄 别急,我们来一步步解锁!


🕵️‍♀️ 第一站:watchValue — 数据的“初始化基地”

代码中的 @Watch('value') 像是数据的“出生证明”:

@Watch('value')
watchValue(v: any) {this.$nextTick(async() => {this.form = {...v,images: v.productPhotos ? JSON.parse(v.productPhotos) : [],genuineIdentificationPointIds: v.genuineIdentificationPoints ? JSON.parse(v.genuineIdentificationPoints) : [],fakeIdentificationPointIds: v.fakeIdentificationPoints ? JSON.parse(v.fakeIdentificationPoints) : []}})
}
  • 发现

    • value 是父组件传递的 props,v 是它的值。
    • form.imagesv.productPhotos 解析而来。
    • genuineIdentificationPointIdsv.genuineIdentificationPoints 解析。
    • fakeIdentificationPointIdsv.fakeIdentificationPoints 解析。
    • 如果没数据,默认是空数组 []
  • 推测:这些数据的“祖先”藏在 value 里,而 value 又是谁给的呢?🤔


🌍 第二站:父组件 index.vue — 数据的“中转站”

父组件是 src/views/tools/fake-strategy/index.vue,它通过 onCompare 将数据传递:

public async onCompare(row: any) {this.compareForm = rowthis.operateType = 'edit'this.compareFormVis = true
}
  • 关键

    • row 是表格一行数据,来自 this.list
    • compareForm = row 赋值给 :value="compareForm",传给 compare-form.vue
  • 数据流

    • row.productPhotosvalue.productPhotosform.images
    • row.genuineIdentificationPointsvalue.genuineIdentificationPointsform.genuineIdentificationPointIds
    • row.fakeIdentificationPointsvalue.fakeIdentificationPointsform.fakeIdentificationPointIds
  • 来源this.list 是从后端 qlist API 获取的。


🗃️ 第三站:后端 API — 数据的“老家”

index.vuegetList 揭示了终极来源:

public async getList() {const res: any = await qlist(this.listQuery)this.list = res?.data?.content
}
  • 真相

    • qlist'@/api/fake-registration' 导入。
    • res.data.content 是数组,每项 row 包含 productPhotosgenuineIdentificationPointsfakeIdentificationPoints
    • 例如:
      {"productPhotos": "[\"http://example.com/image1.jpg\", \"http://example.com/image2.jpg\"]","genuineIdentificationPoints": "[1, 2, 3]","fakeIdentificationPoints": "[4, 5]"
      }
      
  • 老家:后端数据库,通过 qlist API 提供。


🎨 第四站:动态更新 — 用户和 API 的“加成”

genuineIdentificationPointIdsfakeIdentificationPointIds 还能动态变化!通过 watchProductIdgetIdentificationPoints

@Watch('form.productId')
async watchProductId(newVal: any) {if (newVal) await this.getIdentificationPoints(newVal)
}private async getIdentificationPoints(productId: number) {const res: any = await request({url: `/identificationPoint/by-product-id-and-public-type/${productId}/all`})this.identifies1 = res.data.trueIdentificationPoints.map(item => ({id: item.id,name: `${item.id}   ${item.identificationPointTitle}`}))this.identifies2 = res.data.fakeIdentificationPoints.map(item => ({id: item.id,name: `${item.id}   ${item.identificationPointTitle}`}))
}
  • 作用

    • 根据 form.productId 获取产品相关的识别点。
    • identifies1identifies2<w-form-select> 的选项。
    • 用户选择后更新 form.genuineIdentificationPointIdsform.fakeIdentificationPointIds
  • 来源/identificationPoint API 提供动态选项。

  • images 动态:用户通过 <w-form-multiple-image> 上传新图片,更新 form.images


🎉 总结:数据的“家族树”

  1. images

    • 初始value.productPhotos(后端 qlistrow.productPhotos)。
    • 动态:用户上传。
    • 老家:后端 productPhotos 字段。
  2. genuineIdentificationPointIds

    • 初始value.genuineIdentificationPoints(后端 qlist)。
    • 动态:用户从 identifies1 选择,选项来自 /identificationPoint
    • 老家:后端 genuineIdentificationPoints 字段 + API 选项。
  3. fakeIdentificationPointIds

    • 初始value.fakeIdentificationPoints(后端 qlist)。
    • 动态:用户从 identifies2 选择,选项来自 /identificationPoint
    • 老家:后端 fakeIdentificationPoints 字段 + API 选项。

🎨 SVG 图解:数据的旅程

数据的旅程 - SVG 优化演示
数据的旅程 后端 qlist API row 数据 index.vue 传 value compare-form 初始化 form 用户选择/上传 /identificationPoint API 🎨

🛠️ 实践建议

  • 调试console.log(value) 查初始数据,console.log(identifies1, identifies2) 看动态选项。
  • 问题:若数据空,检查 qlist/identificationPoint API 返回。
  • 优化:加错误处理,防止 JSON.parse 失败。

😂 结尾彩蛋

如果数据“失踪”,可能是后端“小哥”忘了更新数据库!😄 赶紧催一催,或者检查网络,找到“宝藏”!👀 喜欢这篇博客?欢迎留言,我下期再带你探秘!🪄


在这里插入图片描述

http://www.dtcms.com/wzjs/805051.html

相关文章:

  • 有了网站 域名然后么做临沂企业建站系统
  • php建网站教程网站建设人员培训
  • 网站建设与推广方式石家庄大的网站开发公司
  • 电子商务网站建设与维护书上海网站建设 普送
  • 局域网网站建设多少钱怎么做关于花的网站
  • 网站导航是什么创意logo图片大全
  • 网站制作 常见问题中国十大房地产公司排名
  • 浙江省网站备案注销申请表外链吧官网
  • 网站怎么搬家网页设计赚钱吗
  • 织梦欧美网站模板做网站为什么要用php
  • 电子商务网站开发规划企业网站搜索引擎推广方法包括
  • 贵州手机网站建设大型网站开发团队的美工需要什么工作经验和教育背景及薪酬
  • 中国建设银行信用卡旅游卡服务网站品牌建设要求
  • .net网站开发软件什么是网络营销?网络营销的内容有哪些?你是怎么理解的?
  • 网站运营软件单页网站制作
  • 优化网站排名推荐公司百度海外视频网站建设
  • 网站建设从零开始 教程wordpress 关键词
  • 中国建设厅官方网站网站建设方法牜金手指下拉覀
  • 建设网站的编程过程可信网站认证有必要吗
  • 南京网站建设咨询小米手机的网站架构
  • 网站建设定价淮北住房和城乡建设局门户网站
  • 深圳住房和建设局网站官网自己创建一个网站需要多少钱
  • 网站该如何做兖州网站建设哪家好
  • 装修企业网站源码python网站开发效率
  • 东莞浩智建设网站哪家比较好营销型企业网站模板
  • 论文网站开发广州专业网站设计定制
  • vs做网站标签输出语言中国建设银行个人登录入口
  • 河南平台网站建设设计农场游戏系统开发 网站建设推广
  • 网站建设差打不开搜索引擎优化排名seo
  • 四川建设人才网网站wordpress 添加角色