记录一下用es6 写一个getCookie

getCookie () {
  let {
    context
  } = this
  let cookie = context.isServer ? context.cookie : document.cookie
  if (typeof cookie !== 'string') return {}
  return cookie
    .split(';')
    .map(item => item.split('=').map(item => item.trim()))
    .reduce(
      (result, item) => {
        result[item[0]] = item[1]
        return result
      },
      {}
    )
}
FLYLEE