• 请不要在回答技术问题时复制粘贴 AI 生成的内容
lenglengyuchen
V2EX  ›  程序员

前端一个表单配置页面,首次编辑时有些字段需要展示默认值,这个默认值应该是查询接口中给还是前端去设置?

  •  
  •   lenglengyuchen · Jun 4, 2024 · 1880 views
    This topic created in 720 days ago, the information mentioned may be changed or developed.

    我是前端,不太理解为啥表单页首次编辑时,查询接口中只给空值字段,不给字段默认值,让前端设置默认值,想让后端直接传但不听,想知道默认值应该前端设置与后端直接给?

    8 replies    2024-06-05 13:15:22 +08:00
    ashuai
        1
    ashuai  
       Jun 4, 2024   ❤️ 1
    打一架,赢的话事!

    惯例,以前 h5 前端不用编译,这种东西放前端改改方便。现在 npm 另说
    yrj
        2
    yrj  
       Jun 4, 2024   ❤️ 1
    空不也是一种默认值嘛
    renmu
        3
    renmu  
       Jun 4, 2024 via Android   ❤️ 1
    谁力气大听谁(
    rabbbit
        4
    rabbbit  
       Jun 4, 2024   ❤️ 1
    这种都是商量着来,谁屌大谁说了算。
    CJ2r4u3EH4lrM7aR
        5
    CJ2r4u3EH4lrM7aR  
       Jun 4, 2024   ❤️ 1
    业务决定,不变就前端做,变就后端做。
    Jaosn
        6
    Jaosn  
       Jun 4, 2024
    这种东西没有对错,要结合业务来看,体验最好肯定是前端配置
    ztcaoll222
        7
    ztcaoll222  
       Jun 4, 2024
    除非默认值必须通过接口才能查询到,不然一律都是前端赋值
    catamaran
        8
    catamaran  
       Jun 5, 2024
    看情况,不变的前端赋值,变化的从后端取
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2823 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 56ms · UTC 15:22 · PVG 23:22 · LAX 08:22 · JFK 11:22
    ♥ Do have faith in what you're doing.