Skip to content

v1.3.0

Compare
Choose a tag to compare
@geekact geekact released this 17 Dec 07:42
· 83 commits to master since this release

日志

  • setState 的回调模式支持返回不完整数据
defineModel('unique_name', {
  initialState: { a: 'a', b: 'b' },
  methods: {
    test() {
      this.setState(() => {
        return { a: 'xxx' };
      });
      console.log(this.state); // { a: 'xxx', b: 'b' }
    },
  },
});
  • 传给 reducer 的 initialState 不再执行深拷贝,而是在开发环境下进行冻结处理以防开发者错误操作
const initialState = { a: 'a', b: 'b' };

defineModel('unique_name', {
  initialState: initialState,
});

// 修改失败,严格模式下会报错
// TypeError: Cannot assign to read only property 'a' of object '#<Object>'
initialState.a = 'xxx';

提交

v1.2.1...v1.3.0