解決antd-pro頁面重新整理後資料丟失
一、重新整理後資料消失
原因所在:資料存在modal的state當中,重新整理的時候state資料丟失。
解決方法:將資料的id放入網頁的路由中,每次進入頁面的時候重新請求資料。
程式碼:
路由配置:
'/information/pageForm/:id':{
component: dynamicWrapper(app, ['dispute'],() => import('../routes/Dispute/PageForm')),
},
從路由中讀取資料:
const pathToRegexp = require('path-to-regexp'); const match = pathToRegexp('/information/pageForm/:id').exec(this.props.location.pathname);
讀取到的資料會存在match這個陣列當中。
頁面跳轉程式碼:
新增時:
this.props.dispatch(routerRedux.push('/information/pageForm/-1'));
編輯時:
this.props.dispatch(routerRedux.push(`/information/pageForm/${record.id}`));
相關推薦
解決antd-pro頁面重新整理後資料丟失
一、重新整理後資料消失 原因所在:資料存在modal的state當中,重新整理的時候state資料丟失。 解決方法:將資料的id放入網頁的路由中,每次進入頁面的時候重新請求資料。 程式碼: 路由配置: '/information/pageForm/:id':{ compo
利用keep-alive activated來解決頁面返回後資料丟失的問題
keep-alive 可以快取頁面的資料,在頁面回跳的時候不會更新資料 activated 在開啟keep-alive時頁面不會重新渲染 也不會進入生命週期 無法監聽資料改變怎麼辦?使用activated來監聽即可 this.$router.push({name:'test',query:{id:123}})
Vuex 頁面重新整理後store儲存的資料會丟失 取cookie值
在store.js中 mutations:{ changepcId(state, _pcid){ state.pcid = _pcid; }, changepostList(state, _postList){
easyui關於解決tab新增的頁面通過href載入資料內容的頁面重新整理後form表單重複提交的問題;
1.分析 Easyui中的tabs元件以href方式載入目標頁面,如果目標頁面中有dialog或者window這類的easyui元件中放了form.那麼在關閉這個tab再次開啟或者點選重新整理.如果進行form提交操作,後臺就會收到兩次提交請求,再次重複以上操作會收到3
關於兩個頁面用params傳資料,重新整理後資料消失的解決
通常我們在兩個頁面傳資料時,一般會採用params,query,或者將資料用vuex,localStorage,sessionStorage儲存起來,然後方便其他頁面呼叫資料,但是params和vuex有一個不好的地方就是隻要我們在接受資料的頁面重新整理一下,傳
history.back返回後資料丟失的解決辦法
js使用history.back返回表單資料丟失的主要原因就是使用了session_start();的原因,該函式會強制當前頁面不被快取。 解決辦法如下: 在你的 Session_start 函式後加入 header("Cache-control: private")
EasyUI頁面重新整理後滾動條沒有恢復到初始位置,已解決
如題,由於大部分瀏覽器都對滾動條的位置有記憶功能,當頁面重新整理後,如果希望滾動條的位置恢復到初始位置,即最頂端,應當在js中呼叫datagrid物件scrollTo(index)方法滾動到指定行。該
頁面重新整理vuex資料消失問題解決方案
VBox持續進行中,哀家苦啊,有沒有誰給個star。 vuex是vue用於資料儲存的,和redux充當同樣的角色。 最近在VBox開發的時候遇到的問題,頁面重新整理或者關閉瀏覽器再次開啟的時候資料歸零。這是頭疼的問題。 網上搜,大家的方案都是把資料轉移到 lo
JS頁面重新整理保持資料不丟失
下面是 DOM Storage 的介面定義: interface Storage { readonly attribute unsigned long length; getter DOMString key(in unsigned long index)
解決移動端頁面滾動後不觸發touchend事件
spa scrip code cli 時有 解決方法 ng- clas parent 解決移動端頁面滾動後不觸發touchend事件 問題 在移動端頁面進行優化時,一般使用touch事件替代鼠標相關事件。用的較多的是使用touchend事件替代P
selenium常見問題:element is not attached to the page document,頁面重新整理後元素失效,需要重新定位元素
測試中,常遇到此問題,特此寫一個重新獲取元素的函式,已供呼叫解決此方法 #找不到元素時,重新獲取元素,eletype預設獲取單個元素,若=1,則獲取多個元素 #weblement有值,則傳入webelement def retying_get_el
攔截器攔截requestbody資料如何防止流被讀取後資料丟失
今天被問到這個問題,百度了一下: 要攔截首先想到的是攔截器,@RequestBody只能以流的方式讀取,流被讀過一次後,就不在存在了,會導致會續無法處理,因此不能直接讀流 為了解決這個問題,思路如下: 1、讀取流前先把流儲存一下 2、使用過濾器攔截讀取,再通過chain.doFi
router路由跳轉使用query傳遞引數重新整理後資料無法獲取
問題描述: 路由進行頁面的跳轉時,使用query進引數傳遞,query中儲存一個較為複雜的物件,頁面初次載入時資料可以成功獲取,重新整理頁面後資料顯示{accountInfo: "[object Ob
頁面重新整理後,tab記住重新整理前位置
最近兩週,時間頗趕,源於對自己身為一個前端的不自信,感覺自己不會的很多。兩週過去了,專案如期完成,我來踩坑了。剩餘的頗多不足就慢慢完善吧! 今天遇到一個問題,頁面重新整理後,對於有tab按鈕的頁面,每
頁面重新整理後 即註冊的事件放這裡 模板
$(document).ready(function(){ //以下是註冊方法 change(); buttonAction(); //顯示主輪播圖 showLunBoPictures(); //顯示商戶動態 ShowD
解決Redis2.X 哨兵模式切換資料丟失
redis 哨兵模式主從切換時候需要間隙性幾秒鐘時間,這時候資料向 master寫入就會導致資料丟失,最簡單的解決方案:private void testJedisEx(){ try{ //進行
頁面重新整理後,自動滾動到原先位置
在ASP.NET頁面中,每次頁面回傳,頁面都會回到頁面頂端,有時候,這是個麻煩,那麼怎麼避免這種情況呢。我總結了三種方式 1.頁面裡有MaintainScrollPositionOnPostback,預設是false,設為true即可 <%@ Page Langu
ASP.Net頁面重新整理後自動滾動到原來位置
在ASP.NET頁面中,每次頁面回傳,頁面都會回到頁面頂端,有時候,這是個麻煩,那麼怎麼避免這種情況呢。網友位總結了三種方式 1.頁面裡有MaintainScrollPositionOnPostback,預設是false,設為true即可 [csharp] view
ASP.NET GridView 後臺繫結行點選行觸發SelectedIndexChanged,頁面重新整理後,只有一頁的情況下,事件只觸發一次
如題,小弟剛接觸asp.net不久,所以有很多不懂,望高手們不吝賜教。 下面進入正題,後臺程式碼如下 <pre name="code" class="csharp"> protected void GridView1_RowDataBound(object se
Windows 下 Redis重啟後資料丟失問題
最近打算學習一下Redis,用的是Windows解壓就能用的版本,往redis伺服器中set好多資料,重啟後發現數據一個也沒有了 (empty list or set) 後來發現啟動redis服務時不能直接點解redis-server.exe檔案,需要在cmd中輸入