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
+19
View File
@@ -0,0 +1,19 @@
Copyright (c) 2017 Blue Bay Travel
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+38
View File
@@ -0,0 +1,38 @@
# Vue JS Cookie
A Vue plugin for managing cookies.
## Installation
**NPM:**
```
npm install vue-js-cookie
```
Include in the `body` after loading Vue.js and it will automatically hook into Vue.
```
<script src="/node_modules/vue-js-cookie/vue-js-cookie.min.js'"></script>
```
## Usage
You can access this plugin either with `this.$cookie` or `Vue.cookie`.
This package uses the very impressive [JS-Cookie](https://github.com/js-cookie/js-cookie/) package.
```js
// Create a cookie that will expire in 7 days
this.$cookie.set('name', 'value', 7)
// Get a cookie
this.$cookie.get('name') // -> value
// Remove a cookie
this.$cookie.remove('name')
```
# License
Blue Bay Travel Vue JS Cookie is licensed under [The MIT License (MIT)](/LICENSE).
+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>
+23
View File
@@ -0,0 +1,23 @@
{
"name": "vue-js-cookie",
"version": "2.1.0",
"main": "vue-js-cookie.js",
"repository": {
"type": "git",
"url": "https://github.com/BlueBayTravel/vue-js-cookie.git"
},
"author": "James Brooks <james@bluebaytravel.co.uk>",
"license": "MIT",
"dependencies": {
"js-cookie": "^2.1"
},
"devDependencies": {
"uglify-js": "^2.6.2",
"vue": "2.0",
"webpack": "^1.12.12"
},
"scripts": {
"build": "webpack example/example.js example/example.build.js && uglifyjs vue-js-cookie.js -c -m > vue-js-cookie.min.js",
"dev": "webpack --watch example/example.js example/example.build.js"
}
}
+43
View File
@@ -0,0 +1,43 @@
;(function () {
var Cookies = typeof require === 'function' ? require('js-cookie') : window.Cookies
if (!Cookies) {
throw new Error('[vue-js-cookie] cannot locate js-cookies')
}
var VueCookie = {
install: function (Vue) {
Vue.prototype.$cookie = this
Vue.cookie = this
},
set: function (name, value, daysOrOptions) {
var opts = daysOrOptions
if (typeof daysOrOptions !== 'object') {
opts = { expires: daysOrOptions }
}
return Cookies.set(name, value, opts)
},
get: function (name) {
return Cookies.get(name)
},
getJSON: function (name) {
return Cookies.getJSON(name)
},
remove: function (name, opts) {
Cookies.remove(name, opts)
}
}
if (typeof exports === 'object') {
module.exports = VueCookie
} else if (typeof define === 'function') {
define([], function () {
return VueCookie
})
} else if (window.Vue) {
window.VueCookie = VueCookie
Vue.use(VueCookie)
}
})()
+1
View File
@@ -0,0 +1 @@
!function(){var e="function"==typeof require?require("js-cookie"):window.Cookies;if(!e)throw new Error("[vue-js-cookie] cannot locate js-cookies");var o={install:function(e){e.prototype.$cookie=this,e.cookie=this},set:function(o,t,n){var i=n;return"object"!=typeof n&&(i={expires:n}),e.set(o,t,i)},get:function(o){return e.get(o)},getJSON:function(o){return e.getJSON(o)},remove:function(e,o){this.remove(e,o)}};"object"==typeof exports?module.exports=o:"function"==typeof define?define([],function(){return o}):window.Vue&&(window.VueCookie=o,Vue.use(o))}();
+1463
View File
File diff suppressed because it is too large Load Diff