@abcum/ember-storage 中文文档教程

发布于 5年前 浏览 21 项目主页 更新于 3年前

ember-storage

用于在 Ember.js 应用程序中使用 localStorage 的实用程序。

Usage

Installation

ember 安装@abcum/ember-storage

Introduction

ember-storage 插件增加了功能 用于从路由、控制器、模板和组件中检索和操作 localStorage 键值项,启用绑定值和计算属性,同时跨页面重新加载持久化数据。

Examples

获取 localStorage['email'] 键的值。

{{storage.email}}

将输入值直接绑定到 localStorage['email'] 键。

{{input type="text" value=storage.email}}

使用存储服务获取 Ember 控制器内的 localStorage['email']

export default Ember.Controller.extend({
    actions: {
        login: function() {
            facebook.login( this.get('storage.email') );
        }
    }
})

Development

  • make install (install bower and ember-cli dependencies)
  • make upgrade (upgrade ember-cli to the specified version)
  • make tests (run all tests defined in the package)

ember-storage

A utility for working with localStorage in an Ember.js app.

Usage

Installation

ember install @abcum/ember-storage

Introduction

The ember-storage addon adds functionality for retrieving and manipulating localStorage key-value items from routes, controllers, templates, and components, enabling bound values and computed properties, whilst persisting data across page reloads.

Examples

Get the value for the localStorage['email'] key.

{{storage.email}}

Binding an input value directly to the localStorage['email'] key.

{{input type="text" value=storage.email}}

Using the storage service to get localStorage['email'] inside an Ember controller.

export default Ember.Controller.extend({
    actions: {
        login: function() {
            facebook.login( this.get('storage.email') );
        }
    }
})

Development

  • make install (install bower and ember-cli dependencies)
  • make upgrade (upgrade ember-cli to the specified version)
  • make tests (run all tests defined in the package)
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文