Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react主应用接入问题---求助大哥们 #426

Closed
Jokerdeath opened this issue Oct 14, 2021 · 4 comments · Fixed by #408
Closed

react主应用接入问题---求助大哥们 #426

Jokerdeath opened this issue Oct 14, 2021 · 4 comments · Fixed by #408
Labels
beta has beta version bug Something isn't working

Comments

@Jokerdeath
Copy link

你好,我这边按照官网文档搭建主应用。代码如下,总是报错。(react应用)

// app.js
import './App.css';
import { AppRouter, AppRoute } from '@ice/stark'
import Home from './page/Home'



function App() {
  
  return (
    <div className="App">
      <Home>
        <AppRouter>
          <AppRoute 
          path='/user'
          exact 
          title='用户' 
          url={[
            'http://localhost:8081/app.js',
            'http://localhost:8081/css/app.css'
          ]}>
          </AppRoute>
          <AppRoute path='/store' title='商户'></AppRoute>
        </AppRouter> 
      </Home>
        
    </div>
  );
}

export default App;
//布局
import React from 'react'
import { Layout, Menu } from 'antd'
import { AppLink } from '@ice/stark'
const { Sider, Content } = Layout

function Home (props) {
    return(
        <>
            <Layout style={{minHeight: '100vh'}}>
        <Sider>
          <Menu theme="dark">
            <Menu.Item key="user">
              <AppLink to="/user">
              用户
              </AppLink>
            </Menu.Item>
            <Menu.Item key="store">
            <AppLink to="/store">
              商户
              </AppLink>
            </Menu.Item>
          </Menu>
        </Sider>
        <Layout>
          <Content>
            2333
          </Content>
        </Layout> 
      </Layout>
        </>
    )
}
export default Home

报错如下
image
感觉和文档差不多啊,为啥啊

@maoxiaoke
Copy link
Collaborator

@Jokerdeath 可以简单提供一个 demo 吗?

@Jokerdeath
Copy link
Author

@Jokerdeath 可以简单提供一个 demo 吗?

啊就create-reat-app了下改了下app.js,加了个home.js没了,demo提供有点麻烦,由于个人原因没办法上传github,望谅解

@Jokerdeath
Copy link
Author

回家后搭了一个简要的,https://github.com/Jokerdeath/icestarkUsage

maoxiaoke added a commit that referenced this issue Oct 15, 2021
@maoxiaoke
Copy link
Collaborator

@Jokerdeath 可以使用下 @ice/stark beta 版本,或者暂时先使用:

import { appHistory } from '@ice/stark-app';

使用方式链接

这个问题我们会在 2.6.2 这个版本中修复

@maoxiaoke maoxiaoke added bug Something isn't working beta has beta version labels Oct 15, 2021
maoxiaoke added a commit that referenced this issue Oct 20, 2021
* fix: 🐛 bind history to window

✅ Closes: #426
@maoxiaoke maoxiaoke mentioned this issue Oct 20, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta has beta version bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants