<script>
export default {
created() {
let checkCookie = this.getCookie("mycookie");
if(checkCookie == 'popupEnd') {
this.dialog = false;
} else {
this.dialog = true;
}
},
data() {
return {
dialog: true,
checkbox: false,
desc: "오늘 하루 동안 보지 않기",
}
},
methods: {
setCookie(name, value){
var today = new Date();
today.setHours(24)
today.setMinutes(0);
today.setSeconds(0);
document.cookie = name + '=' + escape(value) + '; expires=' + today.toGMTString();
// alert(document.cookie);
},
getCookie(name) {
var cookie = document.cookie;
if (document.cookie != "") {
var cookie_array = cookie.split("; ");
// console.log(cookie_array)
for ( var index in cookie_array) {
var cookie_name = cookie_array[index].split("=");
if (cookie_name[0] == "mycookie") {
return cookie_name[1];
}
}
}
return;
},
donotWatchAnymore() {
if(this.checkbox) {
this.setCookie("mycookie", 'popupEnd') ;
}
},
}
}
</script>
https://ko.javascript.info/cookie#ref-146
무슨 고대 문서 처럼 써져있음;