当前位置: 首页 > news >正文

asp的web音乐网站设计个人博客搭建

asp的web音乐网站设计,个人博客搭建,湖北孝感展示型网站建设价格,自建站搭建需求:使用uniapp,模拟key(表名)增删改查对象数组,每个key可以单独操作,并模拟面对对象对应表,每个key对应的baseInstance 类似一个操作类,当然如果你场景比较简单,可以改…

需求:使用uniapp,模拟key(表名)增删改查对象数组,每个key可以单独操作,并模拟面对对象对应表,每个key对应的baseInstance 类似一个操作类,当然如果你场景比较简单,可以改为固定key或者传值key,调普通js而不需要new

base.js

export default {data() {return {}},methods: {// 一是不需要new来调用,二是参数非常灵活,可以不传,也可以这么传createBaseStore(key) {return new this.baseInstance(key || {})},// 函数创建对象 每个key对应自己的方法 达到实例化效果 使用 baseInstance.addExt(obj) 自动携带固定keybaseInstance(key) {this.dataKey = key;this.addExt = function addExt(obj) {var dataList = this.getAllExt()if (dataList == null) {dataList = new Array()}var newItemid = 0const last = dataList.length - 1if (last >= 0) {newItemid = dataList[last].id + 1}obj.id = newItemiddataList.push(obj)this.save(dataList)}this.removeExt = function removeExt(param) {var dataList = this.getAllExt();var findItemIndex = dataList.findIndex(item => {if (item.id == param) {return true}})if (findItemIndex >= 0) {const newList = dataList.splice(findItemIndex, 1)console.log("remove item is index", findItemIndex, JSON.stringify(newList))this.save(dataList)} else {console.log("not find remove param", param)}}this.changeExt = function changeExt() {console.log("change")}this.searchExt = function searchExt() {console.log("search")}this.save = function save(dataList) {var dataJson = JSON.stringify(dataList)uni.setStorage({key: key,data: dataJson,success: function() {console.log("key:", key, 'addExt success', dataJson);console.log('curr size', dataList.length);}});}this.getAllExt = function getAllExt() {try {const value = uni.getStorageSync(this.dataKey);if (!value) {console.log('getAllExt is empty');return null}const dataBean = JSON.parse(value)if (dataBean) {return dataBean}} catch (e) {console.log("showAllToLogExt error", e);}return null}this.showAllToLogExt = function showAllToLogExt() {try {const value = this.getAllExt();if (value) {console.log("showAllToLogExt", value);}} catch (e) {console.log("showAllToLogExt error", e);}}},clearAllExt() {console.log("clearAllExt")uni.clearStorage()}}}

vue使用

<template><view><view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;"><button type="default" v-on:click="showAllToLog()">showAllToLog</button><button type="default" v-on:click="add()">add</button><button type="default" v-on:click="remove()">remove</button><button type="default" v-on:click="change()">change</button><button type="default" v-on:click="search()">search</button><button type="default" v-on:click="clearAll()">clearAll</button></view></view>
</template><script>import base from "@/pages/base/base.js"export default {mixins: [base],data() {return {title: 'demo学习',TestBean: {id: 0,a: "",b: "",c: "",},dataExt: {},dataExt2: {},storeInstance1: this.createBaseStore("key111"),storeInstance2: this.createBaseStore("key222"),indexId: 0}},onload() {getAllExt()},methods: {showAllToLog() {this.storeInstance1.showAllToLogExt()this.storeInstance2.showAllToLogExt()},add() {// 操作类型1实例 ,存对象2到对象数组2var currentTime = new Date();this.dataExt.name = "111"this.dataExt.goodsTime = currentTimethis.storeInstance1.addExt(this.dataExt)// key1Store.remove// key1Store. 等等操作// 操作类型2实例 ,存对象2到对象数组2this.dataExt2.name = "param2"this.dataExt2.param2Time = currentTimethis.storeInstance2.addExt(this.dataExt2)},remove() {// 模拟后续加上id即可目前只是掩饰this.storeInstance1.removeExt(4)this.storeInstance2.removeExt(4)},change() {this.changeExt()},search() {this.searchExt()},clearAll() {this.clearAllExt()},}}
</script><style></style>

http://www.hkea.cn/news/356614/

相关文章:

  • 潍坊快速网站排名网站是怎么做出来的
  • 聚美优品的pc网站建设注册网址
  • 陕西省住房与城乡建设厅网站免费b站推广软件
  • 淮南市住房与城乡建设部网站网店买卖有哪些平台
  • 网页qq表情佛山百度快速排名优化
  • 网站建设方案论文1500社会新闻最新消息
  • 网站组建 需求分析市场监督管理局职责
  • 云课堂哪个网站做的好厦门关键词优化seo
  • 中企动力沈阳分公司seo免费诊断电话
  • 网站vps被黑湖人最新排名最新排名
  • 如何夸奖客户网站做的好seo课程心得体会
  • 有哪些做电子商务的网站时空seo助手
  • 临沂百度网站电脑培训机构哪个好
  • 无锡专业做网站的公司怎样把自己的产品放到网上销售
  • 大学网站建设管理办法推广技巧
  • 长春做网站公司seo关键词排名优化软件怎么选
  • 网站开发未按合同约定工期完工seo关键词排名怎么提升
  • 创可贴app海报制作网站百度seo优化方法
  • 龙岗品牌网站建设2024年新闻摘抄
  • 南阳住房和城乡建设厅网站招聘网站排名
  • 如何做网站活动封面建站的公司
  • 温州网站建设培训营销推广方案包括哪些内容
  • 厦门 建网站商业软文案例
  • wordpress读者墙站长之家seo工具包
  • 网站建设哪家好灵活苏州久远网络北京搜索引擎关键词优化
  • 网站优化怎么做 有什么技巧东莞seo建站
  • 什么网站可以做游戏机疫情最新数据消息
  • 企业网站开发报价单巩义网络推广
  • 网站开发技术交流群免费域名申请网站
  • 手机网站一键分享怎么知道自己的域名