alfhen / vue-cookie Goto Github PK
View Code? Open in Web Editor NEWA Vue.js plugin for manipulating cookies
License: MIT License
A Vue.js plugin for manipulating cookies
License: MIT License
How can remove all cookies?
Would it be possible to add session cookies and ssl cookie support?
for example :
...
this.$cookie.setKey("my hash key")
...
Hi there,
this plugin is comfy (thank you, mr. Alfhen) , but if you want to incapsulate smth in vuex store (for example the choice between cookie and local storage), you may have an issue: from-the-box vuex doesn't know about this.$cookie or vm.$cookie.
I wanna put in the cookie a string which contains '@', but only string before '@' being saved. How can I do that ?
I'm having the following problem:
When I create a cookie by Vue.$cookies.set('example', "user=myself")
The stored cookie becomes user%3Dmyself, but I want it to be exactly as user=myself, that is, they are being encoded.
Is there any option avaiable so that the cookies are not encoded?
not work here ;-(
if I added vue-cookie with tag <script> it is not working
Hey,
When i copy paste the build/vue-cookie.js to my own project and include below the vue.js include and try to call this.$cookie or Vue.cookie i get: Undefined get for undefined.
Does this work without npm?
I want to set a cookie in vuex's mutations.js file,
but when I use 'Vue.cookie' directly, there was an error occurred:
TypeError: WEBPACK_IMPORTED_MODULE_0_vue.default.cookie is not a function
我现在在二级域名下面 second.website.com怎么能删除.website.com的cookie?
没有找到方法。。。是否考虑添加一个
Hello,
It is possible to watch a cookie changement in the vuejs watch property ?
import Vue from "vue";
import VueCookies from 'vue-cookies';
import App from "./App.vue";
import router from "./router";
import store from "./store";
import Axios from "axios";
import Api from "./index";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
Vue.config.productionTip = false;
Vue.use(VueCookies)
Vue.use(ElementUI);
Vue.prototype.$http = Api;
new Vue({
VueCookies,
router,
store,
Axios,
ElementUI,
render: h => h(App)
}).$mount("#app");
I want to set an JSON javascript object in the cookie: this.$cookie.set('test', JSON.stringify(this.json), 1);
Unfortunately, the cookie is not set. What am I doing wrong?
cookie: 'JSESSIONID=node0puin2x7jukign9qrxudu6bvn2.node0; token=92bc658822c92197e3c86f39a5e420f2; connect.sid=s%3AH8OLTKl1mNm_Sx3aFL0DyZ1L1wlKHm9W.zUqgaxcUoefwyGbof9jgBeGYEsaHIyaWQwNSbc3Q8Ho'
Hi i have a scenario where i have to create a cookie with the current hostname as domain, but it's adding an extra dot(.) before the hostname.
let domain = location.hostname
window.$cookies.set('name', 'value', '12h', '/', domain)
Ex: expected domain for cookie: abc.google.com
actual domain name set in cookie .abc.google.com
Thanks.
In my project, cross-domain Settings are set in the background, when I send a axios request, I need to set an extra cookie, but it can't be effective.
Hi, I have a cookie set with an array object. but when I log the value returned its of type string, hence I get this => [ object Object] , [ object Object ] ....
Any idea what I'm doing wrong?
Hi there,
Just installed this module and in my client HTML I have :
<script src="/node_modules/vue-cookie/build/vue-cookie.js'"></script>I am getting a 404 from NodeJs:
GET http://localhost:3000/node_modules/vue-cookie/build/vue-cookie.js
GET /node_modules/vue-cookie/build/vue-cookie.js 404 8.950 ms - 2634
is it not possible to read straight from the node_module?
Thank you
Hi, I am passing a cookie to the browser from my backend, it shows up on the browser cookie extension just fine, but this.$cookie.get('my-cookie') returns null.. any thoughts? and the cookie is not expired.
在微信内浏览器屏蔽ios端的cookies 使用该插件存储值 会获取不到
when the cookie is set on the server side, it has httpOnly set to false, secure to false.
I can access the cookie in the SPA, but unable to delete it(set it to past).
Would be great if you could add support for the getAll() function. Could really use that.
I find this project interesting. Can you explain why not to use tiny-cookie directly? What are the benefits of using Vue plugin?
It would be great if the answers could be added to the README.
If i add a new cookie by the set
method then with the get
method i can fetch it.
BUT if i use the get
method to fetch a cookie that already exist (so i din't use the set
method). In that case the get
method doesnt find anything!
I want to know cookie's expire time...
Hi there! I'm totally new with Vue and front-end in general (I'm backend java developer 😄) therefore I might ask dumb questions, but I'm trying to build a simple Vue app with Vuex and cookie as security token. What I'm currently have:
main.js:
...
import Vue from "vue";
import vueCookie from "vue-cookies";
...
Vue.component(...);
Vue.use(vueCookie);
new Vue({
el: "#app",
router,
store,
template: "<App/>",
components: {App}
});
auth.js:
import Vue from "vue";
...
const state = {
token: this.$cookie.get('token') || "",
...
};
/// other auth code
When I run my app I get 'Cannot read property '$cookie' of undefined' at Vue.prototype.$cookie.get('token')
line. What I'm doint wrong?
Hi,
I noticed you use the isInteger function on line 13. But this is not supported by all browsers like IE11 and older.
Is it maybe possible to adjust to make it browser compatible?
possible solution:
Number.isInteger = Number.isInteger || function(value) {
return typeof value === "number" &&
isFinite(value) &&
Math.floor(value) === value;
};
delete not work in wechat. wechat browser is unnormal, suggest add some workaround.
如何读取指定的cookie?
if you try to import it in a typescript VueJS project (i.e. in main.ts) it gives an error saying types are not defined.
for some reason it will produce true value if false with double ! to convert null value of cookie not created.
i am using vue-cookie in my project, the cookie is set but when i use in the main.js
console.log(this.$cookie.get("test"))
i get the following error ..... any thoughts?
Cannot read property '$cookie' of undefined
Although this.$cookie.get("test")
works in the components without any issue
TIA
Please give ability to set the SameSite and Secure values in the $cookie.set
I'm using this library to store OAuth tokens and I want to set the expiration time of my access_token as the expires_in response, but it is in timestamp.
Could you provide a way of pass the timestamp and get the cookie saved with it as expiration time?
Hi,
the error said, "document is not defined"
for VueCookie.get('username')
when I don't store any session
so, how to check the session first?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.