class Edit { constructor() { pHeader("分类编辑") // 已选 this.principal = get_storage("principal") // 待选 this.additional = get_storage("additional") this.yx(); } yx () { $(".yx").empty() this.principal.forEach(v => { $(".yx").append(`
  • ${v.title}
  • `) }); var self = this $(".yx li").click(function () { self.additional.push(self.principal[$(this).index()]) self.principal = self.principal.filter((v,i) => { if (i != $(this).index()) { return v } }); set_storage("principal", self.principal) set_storage("additional", self.additional) self.yx() }) $(".dx").empty() this.additional.forEach(v => { $(".dx").append(`
  • ${v.title}
  • `) }) var self = this $(".dx li").click(function () { self.principal.push(self.additional[$(this).index()]) self.additional = self.additional.filter((v,i) => { if (i != $(this).index()) { return v } }); set_storage("principal", self.principal) set_storage("additional", self.additional) self.yx() }) } } new Edit()