vue-cookie

Api

 

全局配置

this.$cookies.config(expireTimes[,path])  // default: expireTimes = 1d , path=/

 

Set a cookie

this.$cookies.set(keyName, value[, expireTimes[, path[, domain[, secure]]]])     //return this

 

set expire time: default expire time: 1 day

this.$cookies.set("key","value",1);            // 1 second after, expire

this.$cookies.set("key","value","0");          // end of session - use string!

this.$cookies.set("key","value","30min");      // 30 minute after, expire, ignore case

this.$cookies.set("key","value","1d");         // 1 day after, expire, ignore case

 

Get a cookie

this.$cookies.get(key)        // return value

 

Remove a cookie

this.$cookies.remove(key[, path [, domain]])     // return false or true , warning: next version return this

 

Exist a cookie name

this.$cookies.isKey(key)     // return false or true

 

 

Get All cookie name

this.$cookies.keys()            // return a array

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章