App-framework learning-value passing by panel, appframework

Source: Internet
Author: User
Tags sessionstorage

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...


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.