Giter VIP home page Giter VIP logo

Comments (9)

switer avatar switer commented on September 4, 2024

假设场景:有 A、B两个页面,其中 A 页面为入口打开页面,在A页面ready后调用 .$preload("B") 会触发B页面类级别(还取不到页面实例)的 onPreload 调用,在 onPreload 里发起请求获取数据,就实现了数据的预加载。

from wxpage.

Anan2014 avatar Anan2014 commented on September 4, 2024

请问,在B页面获取数据后,如何进行保存呢,this.$setData() 方法不可用,有没有好的方法

from wxpage.

switer avatar switer commented on September 4, 2024

你可以从文档里了解下 $put 与 $take 方法:

qq20171226-172639 2x

from wxpage.

Anan2014 avatar Anan2014 commented on September 4, 2024

请问这个 $put $cookie $session 这3者的区别有哪些,或者这样说,在哪些场景下使用比较合适

from wxpage.

switer avatar switer commented on September 4, 2024

没有操作cookie,只有$cache
三者的区别在于:

  • $put 是内存级别的缓存,可以存放任何的对象实例、包括引用值或者是函数
  • $session 是基于本地缓存实现的临时缓存,小程序关闭后(一般是微信进程重启)会清空
  • $cache 是永久缓存,微信卸载了会清空(或者程序的清空缓存)

from wxpage.

Anan2014 avatar Anan2014 commented on September 4, 2024

请问小程序只能通过 setDate的方式修改页面上的值吗

from wxpage.

switer avatar switer commented on September 4, 2024

小程序的 setData 应该算是唯一的更新接口..

from wxpage.

Anan2014 avatar Anan2014 commented on September 4, 2024

该框架 $cache 有删除的方法吗

from wxpage.

switer avatar switer commented on September 4, 2024

目前没有删除的方法,$cahce.set(key, null | '') 效果也是一样的

from wxpage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.