zoukankan      html  css  js  c++  java
  • react 修改state某一属性值

    1.state

    // 筛选框相关数据
                searchSelect: { term: { value: '学期', key: '', options: [] }, type_of_personnel: { value: '教师类型', key: '', options: [] }, business_type: { value: '业务类型', key: '', options: [] },cycle_year: { value: '年', key: '', options: [] },cycle_month: { value: '月', key: '', options: [] } },

    2.修改state

                let cycle_month = Object.assign({}, this.state.searchSelect.cycle_month, { key: dateString.split('-')[0] })
                let cycle_year = Object.assign({}, this.state.searchSelect.cycle_year, { key: dateString.split('-')[1] })
                let searchSelect = Object.assign({}, this.state.searchSelect, { cycle_month:cycle_month , cycle_year :cycle_year })
  • 相关阅读:
    bzoj3224
    [洛谷日报第62期]Splay简易教程 (转载)
    bzoj1588
    codeforces467C
    codeforces616B
    codeforces379C
    codeforces545C
    codeforces285C
    codeforces659C
    快读代码level.2
  • 原文地址:https://www.cnblogs.com/thinkingthigh/p/9909600.html
Copyright © 2011-2022 走看看