@iap Packages
    Preparing search index...

    Function getSession

    • 从 sessionStorage 读取值 纯数字字符串自动转换为 number,'true'/'false' 自动转换为 boolean

      Parameters

      • key: string

        存储键

      • def: unknown = ''

        key 不存在或数据不可读时返回,默认为 ''

      Returns unknown

      反序列化后的值(含自动类型转换),或 def

      setSession('step', 2)
      getSession('step') // 2(number)
      getSession('flag') // true / false(boolean)
      getSession('missing', null) // null