React组合(slot插槽)

网友投稿 736 2022-09-09

React组合(slot插槽)

React组合(slot插槽)

子组件

import React, { Component } from 'react';class Slot extends Component { constructor(props) { super(props); this.state = {}; } componentDidMount() { } render() { return (

{this.props.children}
); }}export default Slot;

父组件

import React, { Component } from 'react';import Slot from "../components/Slot"class Antd extends Component { constructor(props) { super(props); this.state = {}; } render() { return (

); }}export default Antd;

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:vite2+vant+postcss搭建移动端
下一篇:with创建临时运行环境
相关文章

 发表评论

暂时没有评论,来抢沙发吧~