Closed dominicleo closed 1 year ago
Hello @dominicleo, your issue has been closed because it does not conform to our issue requirements. Please use the Issue Helper to create an issue, thank you! 你好 @dominicleo,为了能够进行高效沟通,我们对 issue 有一定的格式要求,你的 issue 因为不符合要求而被自动关闭。你可以通过 issue 助手 来创建 issue 以方便我们定位错误。谢谢配合!
路径解析支持数组通配符
支持数据操作
FormPath.getIn(source, 'foo[]'); // [ { bar: 1 }, { bar: 2 }, { bar: 3 } ] FormPath.getIn(source, 'foo[].bar'); // [1, 2, 3]
FormPath.setIn(source, 'foo[].bar', 0); // { foo: [{ bar: 0 }, { bar: 0 }, { bar: 0 }] }
FormPath.setIn(undefined, 'foo[].bar', 1); // { foo: [] } FormPath.setIn(undefined, 'foo[].bar', [1, 2, 3]); // { foo: [{ bar: 1 }, { bar: 2 }, { bar: 3 }] }
FormPath.setIn(undefined, '[].bar', 1); // [] FormPath.setIn(undefined, '[].bar', [1, 2, 3]); // [{ bar: 1 }, { bar: 2 }, { bar: 3 }]
FormPath.deleteIn(source, '[].bar'); // { foo: [{}, {}, {}] }