[英]Why does Onsen UI throw me errors?
我正在使用帶有react-onsenui綁定的React和Onsen UI構建PWA。 我嘗試讓Tabbar適應Onsen UI網站上顯示的官方示例。 目前,我的代碼如下所示(非常簡單):
import React, { Component } from 'react';
import { Page, Tabbar, Tab } from 'react-onsenui';
import 'onsenui/css/onsenui.css';
import 'onsenui/css/onsen-css-components.css';
import ScreenOne from './screenOne';
import ScreenTwo from './screenTwo';
class App extends Component {
state = {
index: 0,
}
render() {
return (
<Page>
<Tabbar
onPreChange={({index}) => this.setState({index})}
onPostChange={() => console.log('postChange')}
onReactive={() => console.log('postChange')}
position='bottom'
index={this.state.index}
renderTabs={(activeIndex, tabbar) => [
{
content: <ScreenOne key="Home" title="Home" active={activeIndex === 0} tabbar={tabbar} />,
tab: <Tab key="Home" label="Home" icon="md-home" />
},
{
content: <ScreenTwo key="Settings" title="Settings" active={activeIndex === 1} tabbar={tabbar} />,
tab: <Tab key="Settings" label="Settings" icon="md-settings" />
}]
}
/>
</Page>
);
}
}
export default App;
但是,它不起作用。 我可以單擊一次選項卡,僅此而已。 控制台向我拋出錯誤。
初始頁面加載時
Uncaught TypeError: el._show is not a function
at onsenui.js:31327
at run (setImmediate.js:48)
at runIfPresent (setImmediate.js:83)
at onGlobalMessage (setImmediate.js:125)
在標簽上單擊
onsenui.js:31057 Uncaught (in promise) TypeError: prevTab.pageElement._hide is not a function
at HTMLElement._onPreChange (onsenui.js:31057)
at Swiper._changeTo (onsenui.js:15695)
at Swiper.setActiveIndex (onsenui.js:15479)
at onsenui.js:31233
我現在完全被困住了。 謝謝。
您可以發布ScreenOne和ScreenTwo組件嗎? 檢查這兩個組件是否由'Page'標簽包裹
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.