-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MMKV for HarmonyOS NEXT 是否可以提供自定义对象的存取接口? #1282
Comments
As far as I learned, there's nothing like Parcel in Android. So no, not in our plans. |
1.3.5版本对外导出的 是ets文件, 在鸿蒙工程中无法在ts文件 import ets,导致无法使用。 官方是否有计划 将导出ets文件改为ts, 避免有使用限制。 |
How can one do that? I'd love to know. |
For the time being, you can encode/decode the object into JSON first. It's not ideal but it can get you going. let user = {
username: 'lingol',
age: 21
}
// Serialize the object into a JSON string
mmkv.encodeString('user', JSON.stringify(user))
// Deserialize the JSON string into an object
let jsonUser = mmkv.decodeString('user') // { 'username': 'lingol', 'age': 21 }
let userObject = JSON.parse(jsonUser) |
目前最新版本1.3.5支持boolean, number, bigint, string,boolean[], number[], string[], ArrayBuffer类型,是否可以提供自定义对象的存取接口?如果可以提供的话,麻烦回复一下时间、版本计划,多谢。
The text was updated successfully, but these errors were encountered: