zoukankan      html  css  js  c++  java
  • 0511 Braft Editor和嵌套路由

    1、 Braft Editor

    https://margox.github.io/braft-editor/

    npm install braft-editor --save
    import 'braft-editor/dist/index.css'
    import React from 'react'
    import BraftEditor from 'braft-editor'
    
    export default class CustomDemo extends React.Component {
    
      render () {
    
        const controls = [
          {
            key: 'bold',
            text: <b>加粗</b>
          },
          'italic', 'underline', 'separator', 'link', 'separator', 'media'
        ]
    
        return (
          <div className="editor-wrapper">
            <BraftEditor
              controls={controls}
              contentStyle={{height: 210, boxShadow: 'inset 0 1px 3px rgba(0,0,0,.1)'}}
            />
          </div>
        )
    
      }
    
    }
    

      2、复习嵌套路由

    总路由,作为根组件

    分支里没有exact

    const BasicRoute = (props) => (
      <HashRouter>
          <Switch>
              <Route exact path="/" component={Mainpage}/>
    
              <Route  path="/home" component={Mainpage}/>
              <Route exact path="/my" component={Add}/>
          </Switch>
        <BottomMenu />
      </HashRouter>
    );

    子路由及菜单

    function Mainpage(){
      return(
        <div>
          <div className="headmenu">
            <ul >  
                <MenuItem href="#/" name="home" index="0" />
                <MenuItem href="#/home/detail" name="detail" index="1" />
                <MenuItem href="#/home/third" name="third" index="2" />
            </ul>
          </div>
          <Switch>
              <Route exact path="/" component={AList}/>
              <Route exact path="/home" component={AList}/>
              <Route exact path="/home/detail" component={Detail}/>
              <Route exact path="/home/third" component={Detail}/>
           </Switch>   
    
          </div>
      )
    }

    效果

  • 相关阅读:
    PDF文档生成缩略图
    zTree数据回显
    window.showModalDialog基础
    Java获取两个时间段内的所有日期
    CSS设置超出表格的内容用省略号显示
    Ajax提交form表单
    普通java类在Tomcat启动时获取ServletContext
    mysql中sql优化和合理使用索引
    mysql数据类型详解系列
    如何干净的清除slave同步信息
  • 原文地址:https://www.cnblogs.com/cnchengv/p/14756867.html
Copyright © 2011-2022 走看看