chushihua

This commit is contained in:
li
2026-01-26 23:20:48 +08:00
commit 7b5aab0206
22521 changed files with 3300090 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
var Vue = require('vue')
var VueCookie = require('../')
Vue.use(VueCookie)
var COUNTER_NAME = 'vue-js-counter'
new Vue({
el: 'div',
data: {
counter: 0
},
ready: function () {
if (this.$cookie.get(COUNTER_NAME)) {
this.counter = parseInt(this.$cookie.get(COUNTER_NAME), 10)
}
setInterval(function () {
this.increment()
}.bind(this), 1000)
},
methods: {
increment: function () {
this.counter += 1
}
},
watch: {
counter: function (value) {
this.$cookie.set(COUNTER_NAME, value)
}
}
})
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Vue JS Cookie</title>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
</head>
<body>
<div>Counted to <strong>{{ counter }}</strong></div>
<p>Refresh to see the same value!</p>
<script src="example.build.js"></script>
</body>
</html>