-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat:add online solution links for qiankun #2754
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
Open
gjmhandsome
wants to merge
7
commits into
umijs:next
Choose a base branch
from
gjmhandsome:feature/error_code
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7429bc9
feat:add online solution links for qiankun
gjmhandsome 207308e
chore:update QiankunError
gjmhandsome 74bc9c8
Create chilled-radios-retire.md
kuitos 8ea88e3
chore:format QiankunError
gjmhandsome 706c0a1
chore:adapt to old QiankunError usage
gjmhandsome 15f7ef2
Merge branch 'next' into feature/error_code
gjmhandsome 43a31d3
chore:update all QiankunError usage
gjmhandsome File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react' | ||
|
||
export default function CodeSnippet(props) { | ||
const lines = props.children.split('\n') | ||
const firstTextualLine = lines.find(l => l.trim() !== l) | ||
const numLeadingSpaces = firstTextualLine ? /([^\s])/.exec(firstTextualLine).index : 0 | ||
const formattedLines = lines.map(line => line.slice(numLeadingSpaces)).filter((line, i) => line.length > 0 || i > 0).join('\n') | ||
return ( | ||
<div className="__dumi-default-code-block"> | ||
<pre className="prism-code language-tsx"> | ||
{formattedLines} | ||
</pre> | ||
</div> | ||
|
||
) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react' | ||
import CodeSnippet from '../CodeSnippet' | ||
|
||
export default function ErrorCode1(props) { | ||
return ( | ||
<> | ||
<h1>#1: Application died in status NOT_MOUNTED: Target container with #container not existed after {props.getErrorCodeArg(0)} mounted!</h1> | ||
<p> | ||
This error thrown as the container DOM does not exist after the micro app is loaded. The possible reasons are: | ||
</p> | ||
<h4> | ||
1.The root id of the micro app conflicts with other DOM, and the solution is to modify the search range of the root id. | ||
</h4> | ||
<div> | ||
<h4>vue micro app:</h4> | ||
<CodeSnippet> | ||
{` | ||
function render(props = {}) { | ||
const { container } = props; | ||
instance = new Vue({ | ||
router, | ||
store, | ||
render: (h) => h(App), | ||
}).$mount(container ? container.querySelector('#app') : '#app'); | ||
} | ||
export async function mount(props) { | ||
render(props); | ||
} | ||
`} | ||
</CodeSnippet> | ||
<h4>react micro app:</h4> | ||
<CodeSnippet> | ||
{ ` | ||
function render(props) { | ||
const { container } = props; | ||
ReactDOM.render(<App />, container ? container.querySelector('#root') : document.querySelector('#root')); | ||
} | ||
export async function mount(props) { | ||
render(props); | ||
} | ||
export async function unmount(props) { | ||
const { container } = props; | ||
ReactDOM.unmountComponentAtNode(container ? container.querySelector('#root') : document.querySelector('#root')); | ||
} | ||
`} | ||
</CodeSnippet> | ||
</div> | ||
<h2>Explanation:</h2> | ||
<p> | ||
<a href="/qiankun/faq#application-died-in-status-not_mounted-target-container-with-container-not-existed-after-xxx-mounted">FAQ</a> | ||
</p> | ||
</> | ||
) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* sidebar: false | ||
*/ | ||
|
||
import React from 'react' | ||
import { useLocation, useParams } from 'react-router-dom'; | ||
import Error1 from './codes/1' | ||
import { useSearchParams } from 'dumi'; | ||
const r = require.context('./codes/', false, /\.tsx$/); | ||
|
||
export default function CodeSnippet() { | ||
let [searchParams, setSearchParams] = useSearchParams(); | ||
const code = searchParams.get('code'); | ||
const Comp = code && r(`./${code}.tsx`).default; | ||
const errorCodeArgs = searchParams.getAll('arg'); | ||
|
||
return code ? ( | ||
<div> | ||
<Comp errorCodeArgs={errorCodeArgs} | ||
getErrorCodeArg={getErrorCodeArg} | ||
errorCode={code} /> | ||
</div> | ||
) : (<div>请输入错误码code</div>) | ||
|
||
function getErrorCodeArg(index, argName) { | ||
const missingArg = argName ? `(${argName})` : `(unknown)`; | ||
return errorCodeArgs.length > index ? errorCodeArgs[index] : missingArg; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.