js创建数据库

requests.onerror = function(event) {
					console.log('数据库打开报错!');
				}
				requests.onupgradeneeded = function(event) {
					console.log('数据库升级');
					var db = requests.result;
					if (!db.objectStoreNames.contains("person")) {
						console.log("创建person对象仓库");
						var objectStore = db.createObjectStore("person", {
							keyPath: "id",
							autoIncrement: true
						});
						console.log("创建索引");
						objectStore.createIndex("name", "name", {
							unique: false
						});
						objectStore.createIndex("email", "email", {
							unique: true
						})
					}
				}
			} else {
				alert(";浏览器版本过低")
			}
上一篇:Leetcode 268. 丢失的数字 异或


下一篇:python的简单例题5