|
|
@ -145,18 +145,46 @@ export default { |
|
|
|
}; |
|
|
|
}, |
|
|
|
created(){ |
|
|
|
if(process.client){ |
|
|
|
let storeCache = this.$cookies.get("storeCache"); |
|
|
|
if(storeCache!=undefined){ |
|
|
|
this.isCookieHasBeenClicked = JSON.parse(storeCache); |
|
|
|
//this.$cookies.set("storeCache",JSON.stringify(true),1); //一開始先設cookie為顯示 |
|
|
|
if(process.client){ //若是在client端 |
|
|
|
let storeCache = this.$cookies.get("storeCache"); //取storeCache(false) 有顯示 |
|
|
|
if(storeCache == undefined){ |
|
|
|
this.isCookieHasBeenClicked = true; |
|
|
|
} |
|
|
|
if(storeCache == true){ |
|
|
|
this.isCookieHasBeenClicked = false; |
|
|
|
}else{ |
|
|
|
this.isCookieHasBeenClicked = true; |
|
|
|
} |
|
|
|
// if(storeCache == undefined){ // |
|
|
|
// this.$cookies.set("storeCache",JSON.stringify(true),1); |
|
|
|
|
|
|
|
// }else if(storeCache == false){ |
|
|
|
// this.$cookies.set("storeCache",JSON.stringify(true),1); |
|
|
|
|
|
|
|
// }else{ |
|
|
|
// this.isCookieHasBeenClicked = JSON.parse(storeCache); |
|
|
|
// } |
|
|
|
|
|
|
|
// if(storeCache != undefined){ |
|
|
|
// this.isCookieHasBeenClicked = JSON.parse(storeCache); |
|
|
|
// } |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
isCookieHasBeenClicked: { |
|
|
|
handler: function () { |
|
|
|
if(this.isCookieHasBeenClicked == false){ |
|
|
|
this.$cookies.set("storeCache",JSON.stringify(true), 1); |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
closeCookie(){ |
|
|
|
if(process.client){ |
|
|
|
console.log(process.client ? true : false); |
|
|
|
if(process.client){ //在client端的時候 |
|
|
|
this.isCookieHasBeenClicked = false; |
|
|
|
this.$cookies.set("storeCache",JSON.stringify(false),1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|