亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

用nowa創建的dingtalk項目,路由應該怎么寫?

用nowa創建的dingtalk項目,路由應該怎么寫?

PageHome.jsx

require('./PageHome.less');

import logic from './PageLogic';

import { Control, Route } from 'react-keeper';

import { Component, LogicRender } from 'refast';


import TabBar, { activeTabbar } from 'components/card-tabbar';

import { NavBar } from 'antd-mobile';



class Home extends Component {

? ? constructor(props) { super(props, logic);

? ? ? ? this.handleChange = this.handleChange.bind(this);

? ? }


? ? handleChange(key){

? ? ? ? this.dispatch('setTabbarIndex',key);

? ? ? ? Control.go(this.state.menu[key].path, ); // keeper的跳轉

? ? ? ? alert(this.props.children);

? ? }


? ? render() {

? ? ? ? const { state: { menu, tabbarIndex, badge, },? } = this;

? ? ? ? const activeIndex=activeTabbar( menu );


? ? ? ? if (tabbarIndex != activeIndex? ){ // 對比url索引和當前選中的值,如不對應則糾正.

? ? ? ? ? ? this.dispatch('setTabbarIndex',activeIndex);

? ? ? ? }


? ? ? ? return (

? ? ? ? ? ? <div className="home">

? ? ? ? ? ? ? ? <NavBar

? ? ? ? ? ? ? ? ? ? iconName=""

? ? ? ? ? ? ? ? ? ? mode="light">

? ? ? ? ? ? ? ? ? ? 菜單

? ? ? ? ? ? ? ? </NavBar>


? ? ? ? ? ? ? ? {/*中間嵌套的頁面*/}

? ? ? ? ? ? ? ? {this.props.children}


? ? ? ? ? ? ? ? <TabBar menu={menu} tabbarIndex={tabbarIndex} badge={badge} onChange={this.handleChange} />

? ? ? ? ? ? </div>

? ? ? ? );

? ? }


? ? componentDidMount() {

? ? ? ? dd.biz.navigation.setTitle({ title:'Home' })

? ? }


}

PageLogic.jsx

import { apiSync } from 'utils'

import PageConst from './PageConst';


export default {

? ? defaults(props) {

? ? ? ? return {? empty: true, loading: false, ...PageConst,?

? ? ? ? ? ? tabbarIndex: 0,

? ? ? ? }

? ? },


? ? setTabbarIndex( ctx, data ) {

? ? ? ? ctx.setState({ tabbarIndex:data })

? ? },


};

PageConst.js

export default {

? ? menu: [

? ? ? ? {"title":"導航", "icon":"nav", "path":"/home/nav" },

? ? ? ? {"title":"數據錄入", "icon":"entry", "path":"/home/entry"? },

? ? ? ? {"title":"數據顯示", "icon":"display", "path":"/home/display"? },

? ? ? ? {"title":"反饋", "icon":"feedback", "path":"/home/feedback"? },

? ? ? ? {"title":"其它", "icon":"other", "path":"/home/other"? }

? ? ],

}

我添加了以上路徑的文件,如display

import React, { Component } from 'react'

// other import


export default class displayextends Component {

? render(){

? ? return (<div>

? ? ? 這是一個頁面

? ? ? </div>

? ? )

? }

}

為什么tab切換沒有內容

正在回答

舉報

0/150
提交
取消

用nowa創建的dingtalk項目,路由應該怎么寫?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號