@fe6/water-pro
Version:
An enterprise-class UI design language and Vue-based implementation
28 lines (24 loc) • 556 B
JSX
import PropTypes from '../../_util/vue-types';
export default {
props: {
children: PropTypes.func.def(() => null),
},
methods: {
getRef(name) {
return this[name];
},
saveRef(name) {
return (node) => {
if (node) {
this[name] = node;
}
};
},
},
render() {
// 每次都new一个新的function,避免子节点不能重新渲染
const saveRef = (name) => this.saveRef(name);
const getRef = (name) => this.getRef(name);
return this.children(saveRef, getRef);
},
};