适用于存储的 getItem 方法

getItem(
  key: string
): string | null;

返回与给定键关联的当前值;如果给定键不存在,则返回 null。

示例

let starsEarned = Number(GameSnacks.storage.getItem('starsEarned'));