feat:web端增加刷新书签树功能

This commit is contained in:
fanxb 2020-01-31 00:42:51 +08:00
parent 8ece106c03
commit 783d12b7b8
2 changed files with 22 additions and 2 deletions

View File

@ -3,7 +3,11 @@ import { Tree, Empty, Button, Spin } from "antd";
import MainLayout from "../../../layout/MainLayout";
import styles from "./index.module.less";
import { batchDelete, renderTreeNodes, onDrop } from "./function.js";
import { cacheBookmarkData, getBookmarkList } from "../../../util/cacheUtil";
import {
cacheBookmarkData,
getBookmarkList,
clearCache
} from "../../../util/cacheUtil";
import AddModal from "./AddModal";
import Search from "../../../components/Search";
@ -85,6 +89,15 @@ class OverView extends React.Component {
}
}
/**
* 同步书签数据
*/
async refreshTree() {
const { refresh } = this.state;
await clearCache();
refresh();
}
render() {
const {
isEdit,
@ -105,6 +118,13 @@ class OverView extends React.Component {
<div className={styles.header}>
<div className={styles.left}>
<span className={styles.myTree}>我的书签树</span>
<Button
size="small"
type="primary"
icon="sync"
shape="circle"
onClick={this.refreshTree.bind(this, null)}
/>
<Button
size="small"
type="primary"

View File

@ -25,7 +25,7 @@ export const REFRESH = "refresh";
export const refresh = () => {
return {
type: REFRESH,
data: getInitData()
data: {}
};
};