add:okCookie使用方法

master
bobi 2019-11-02 14:44:10 +08:00
parent 956677419f
commit 68fcb95f08
2 changed files with 30 additions and 1 deletions

View File

@ -409,6 +409,10 @@
"title": "jquery.countup.js",
"href": "pages/tripartite/countup.html"
},
{
"title": "okCookie",
"href": "pages/tripartite/okCookie.html"
},
{
"title": "okToastr",
"href": "pages/tripartite/okToastr.html"

View File

@ -8,12 +8,37 @@
</head>
<body>
<div class="ok-body">
<blockquote class="layui-elem-quote">
<p>JavaScript Cookies操作</p>
</blockquote>
<pre>
layui.use(["okCookie"], function () {
let $ = layui.jquery;
<br/>
// 创建cookie
$.cookie("hello", "word")
// 读取cookie
let hello = $.cookie("hello");
console.log(hello);
// 删除cookie
$.cookie("hello", null);
});
</pre>
</div>
<!--js逻辑-->
<script src="../../lib/layui/layui.js"></script>
<script>
layui.use(["okCookie"], function () {
layui.use(["code", "okCookie"], function () {
let code = layui.code;
let $ = layui.jquery;
code({
elem: "pre",
title: "代码示例"
});
// 创建cookie
$.cookie("hello", "word")