UNPKG

micro-ui-y

Version:

59 lines (47 loc) 1.7 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports._Check = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // import Immutable from 'immutable'; /** * Check 校验方法集合 * 需要依赖 Immutable 插件 * @Author gufuyan * @Date 2019-09-20 */ var CheckFn = //函数参数默认值 function CheckFn() { _classCallCheck(this, CheckFn); this.getShouldComponentUpdate = function (thisProps, nextProps) { // let updateFlag = false; // let nextPropsItem = {}, thisPropsItem = {}; // for (let item of propsName) { // nextPropsItem = {}, thisPropsItem = {}; // nextPropsItem[item] = nextProps[item]; // thisPropsItem[item] = thisProps[item]; // // //只要有一个为false 不相等,需要渲染render,终止循环 // if (!Immutable.Map(nextPropsItem).equals(Immutable.Map(thisPropsItem))) { // updateFlag = true; // break; // } // } // return updateFlag; var propsName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; }; } /*** * react shouldComponentUpdate 是否是否更新 render * @param propsName 调用组件的props集合 * @returns {boolean} */ ; var _Check = new CheckFn(); exports._Check = _Check; //# sourceMappingURL=check.js.map