App-framework learning-value passing by panel, appframework
Author: Mu Chen Date:
App-framework learning-value passing by panel
Many people have asked about the appframework page value passing question. Here are some suggestions:
1. Local Data Access
/******** Local data access function *********/var localStorageUtils = {setParam: function (name, value) {localStorage. setItem (name, jsonUtils. toString (value) ;}, getParam: function (name) {var obj = localStorage. getItem (name); return jsonUtils. toJson (obj) ;}, removeParam: function (key) {return localStorage. removeItem (key );}}
2. session data access
<Pre name = "code" class = "javascript">/******** <span style = "font-family: Arial, Helvetica, sans-serif; "> session data access function </span> *********/
Var sessionStorageUtils = {setParam: function (key, value) {sessionStorage. setItem (key, value)}, getParam: function (key) {return sessionStorage. getItem (key)}, removeParam: function (key) {return sessionStorage. removeItem (key );}}
3. Use the data-value Method
<div id="panelID" class="panel"></>
js:
var value = {a:"aaa",b:"bbb"};
// Settings:
$("#panelID").data("value",value);
// Obtain
var dataset = $("#panelID").data("value");
console.info(dataset);
4. String truncation...