diff --git a/src/components/SearchGrade.vue b/src/components/SearchGrade.vue
index ba5954acad1a6207aa16de89d871919b01a9423a..776d0fca522a9dd467701c2933ecad2557a5c9a6 100644
--- a/src/components/SearchGrade.vue
+++ b/src/components/SearchGrade.vue
@@ -43,16 +43,16 @@ const state = reactive({
return range[0] + '-' + range[1] + ' 共' + total + '篇博客';
},
onShowSizeChange: changePageSize, // 改变每页数量时更新显示
- onChange:changePage,//点击页码事件
+ onChange: changePage,//点击页码事件
}
})
-function changePage(page,pageSize){
- state.pagination.current= page
- state.pagination.pageSize= pageSize
+function changePage(page, pageSize) {
+ state.pagination.current = page
+ state.pagination.pageSize = pageSize
}
-function changePageSize(current,pageSize){
- state.pagination.current= current
- state.pagination.pageSize= pageSize
+function changePageSize(current, pageSize) {
+ state.pagination.current = current
+ state.pagination.pageSize = pageSize
}
const getCsdnData = (uId) => {
@@ -75,9 +75,7 @@ const getCsdnData = (uId) => {
initFirstData()
})
}
-onMounted(() => {
- // onSearch()
-})
+
const onSearch = () => {
if (!state.searchValue) {
return window.alert('请输入用户id')
@@ -129,7 +127,6 @@ function initFirstData() {
},
tooltip: {
formatter: function (params) {
- console.log('params', params)
const findItem = state.dataSource.find(item => {
return item.postTime == params.name
})
@@ -154,7 +151,7 @@ function initFirstData() {
position: 'center',//在上方显示
textStyle: {//数值样式
fontSize: '2px',
- color: 'white'
+ color: 'blue'
}
},
markPoint: {
@@ -182,12 +179,25 @@ function initFirstData() {
window.open(findItem.src, '_blank')
}
});
+
+ onMounted(() => {
+ const storageUid=window.localStorage.getItem('csdnUid')
+ if(storageUid){
+ state.searchValue=storageUid
+ onSearch()
+ }
+ })
onUnmounted(() => {
window.onresize = null
+ if (!state.searchValue) {
+ window.localStorage.removeItem('csdnUid')
+ }
+ else {
+ if (!state.searchValue) {
+ window.localStorage.setItem('csdnUid', state.searchValue)
+ }
+ }
})
- function jumpUrl(url){
- window.open(url, '_blank')
- }
}
@@ -200,7 +210,7 @@ function initFirstData() {