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

完善了“全部导出”功能 #220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
"@fortawesome/fontawesome-free": "^5.15.3",
"amis": "6.7.0",
"amis-core": "6.7.0",
"amis-formula": "6.7.0",
"amis-ui": "6.7.0",
"amis-editor": "6.7.0",
"amis-editor-core": "6.7.0",
"amis-editor-demo": "file:",
"amis-formula": "6.7.0",
"amis-ui": "6.7.0",
"axios": "0.21.1",
"copy-to-clipboard": "^3.2.0",
"mobx": "4.15.7",
Expand All @@ -43,6 +44,7 @@
"react-router-dom": "5.0.1"
},
"devDependencies": {
"@types/file-saver": "^2.0.7",
"@types/lodash": "^4.14.123",
"@types/node": "^11.13.8",
"@types/qs": "^6.5.3",
Expand Down
9 changes: 8 additions & 1 deletion src/route/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {Link} from 'react-router-dom';
import NotFound from './NotFound';
import AMISRenderer from '../component/AMISRenderer';
import AddPageModal from '../component/AddPageModal';
import {saveAs} from 'file-saver';

function isActive(link: any, location: any) {
const ret = matchPath(location?.pathname, {
Expand All @@ -24,6 +25,12 @@ export default inject('store')(
location,
history
}: {store: IMainStore} & RouteComponentProps) {
function handleExportAll() {
const data = JSON.stringify(store.pages, null, 2);
const blob = new Blob([data], {type: 'application/json'});
saveAs(blob, 'amis_pages_export.json');
}

function renderHeader() {
return (
<>
Expand All @@ -35,7 +42,7 @@ export default inject('store')(
</div>
<div className={`cxd-Layout-headerBar`}>
<div className="hidden-xs p-t-sm ml-auto px-2">
<Button size="sm" className="m-r-xs" level="success" disabled>
<Button size="sm" className="m-r-xs" level="success" onClick={handleExportAll}>
全部导出
</Button>
<Button
Expand Down