Skip to content

Simple initValue will throw error 'Cannot read properties of undefined ' #112

@349989153

Description

@349989153
      let mySelect = new MobileSelect({
        trigger: '#city1',
        wheels: [
          {data:[{id: '1', value:'周日'}, {id: '2',value:'周一'}]},
          {data:[{id: '3', value: '08:00'}, {id: '4', value: '09:00'}]}
        ],
        initValue: "周一 09:00",
        keyMap: {
          id: "id",
          value: "value",
        },
      });

and it throws

mobile-select.umd.js:7 Uncaught TypeError: Cannot read properties of undefined (reading 'undefined')
    at mobile-select.umd.js:7:5066
    at Array.reduce (<anonymous>)
    at u.getPositionByInitValue (mobile-select.umd.js:7:4963)
    at u.init (mobile-select.umd.js:7:2729)
    at new u (mobile-select.umd.js:7:1805)
    at HTMLDocument.<anonymous> (test.html?_ijt=lkl8j1rfu6860ah28plbh3dh4s&_ij_reload=RELOAD_ON_SAVE:69:22)
    at c (jquery.min.js:3:7857)
    at Object.fireWith [as resolveWith] (jquery.min.js:3:8658)
    at Function.ready (jquery.min.js:3:3266)
    at HTMLDocument.H (jquery.min.js:3:695)

use:
mobile-select v1.4.0
mobile-select.umd.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions