weex icon indicating copy to clipboard operation
weex copied to clipboard

Uncaught TypeError: storage.setItem is not a function

Open jiangyoucai opened this issue 10 years ago • 4 comments

调用本地存储报错 Uncaught TypeError: storage.setItem is not a function 难道是因为版本的问题? weex --version info 0.4.5

var storage = require('@weex-module/storage');
storage.setItem('bar', 'bar-value', function(e) {
  // callback.'e' is an object that contains 'result' and 'data'. e.result indicate wether `setItem` is succeed.
  // e.data will return 'undefined' if success or 'invalid_param' if your key/value is ""/null.
});

jiangyoucai avatar Aug 12 '16 07:08 jiangyoucai

@Rowandjj @pythons

luics avatar Aug 15 '16 03:08 luics

@jiangyoucai 是在哪个平台报的问题? weex sdk版本是多少?检查下sdk里是否有storagemodule。

Rowandjj avatar Aug 15 '16 08:08 Rowandjj

@jiangyoucai SDK 0.7.0 才支持 storage 哦。

pythons avatar Aug 15 '16 08:08 pythons

@luics close 吧,@jiangyoucai 他的版本是 v0.4.5, 不支持 storage

pythons avatar Aug 15 '16 09:08 pythons