forked from p96170835/amis
先修复一下路径
This commit is contained in:
parent
3e43ca399c
commit
ee6d65b65d
|
@ -30,9 +30,8 @@ glob('./docs/**/*.md', {}, function (er, docs) {
|
|||
.replace(/!?\[.*\]\(.*\)/g, '')
|
||||
.replace(/\n/g, '')
|
||||
.replace(/```.*```/g, '')
|
||||
|
||||
.toLowerCase(),
|
||||
path: doc.replace('.md', '')
|
||||
path: doc.slice(1).replace('.md', '')
|
||||
});
|
||||
}
|
||||
fs.writeFileSync('./examples/docs.json', JSON.stringify(resultData));
|
||||
|
|
|
@ -5,6 +5,12 @@ import React from 'react';
|
|||
import Axios from 'axios';
|
||||
import SearchBox from '../../src/components/SearchBox';
|
||||
|
||||
let ContextPath = '';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
ContextPath = '/amis';
|
||||
}
|
||||
|
||||
export default class DocSearch extends React.Component {
|
||||
docs = [];
|
||||
constructor(props) {
|
||||
|
@ -74,7 +80,7 @@ export default class DocSearch extends React.Component {
|
|||
<div className="search-result">
|
||||
{searchResults.map(item => {
|
||||
return (
|
||||
<a href={'/' + item.path} key={`list_${item.path}`}>
|
||||
<a href={ContextPath + item.path} key={`list_${item.path}`}>
|
||||
<h5>{item.title}</h5>
|
||||
<p dangerouslySetInnerHTML={{__html: item.abstract}} />
|
||||
</a>
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue