Skip to content

设置cookie ​

方法名 ​

setCookie

用法 ​

示例 ​

js
this.$refs.refLevenUtsWebview.setCookie({
  //名称,必须
  name: this.form.name,
  //值,必须
  value: this.form.value,
  //域名,必须
  domain: this.form.domain,
  //存活时间,单位:秒,默认:86400
  maxAge: this.form.maxAge,
  //路径,默认:/
  path: this.form.path
}, res => {
  console.log("设置cookie:" + JSON.stringify(res))
})

参数说明 ​

参数名参数类型是否必填默认值参数描述
nameString是无cookie名称
valueString是无cookie的值
domainString是无域名
maxAgeInteger否86400cookie存活时间,单位:秒
pathString否/域名路径

回调 ​

示例 ​

json
{
    "message": "",
    "code": 0,
    "data": {}
}

回调说明 ​

参数名参数类型参数描述
messageString消息提示
dataObject数据对象
codeInteger返回类型,0.成功,其他:失败