同步代码
This commit is contained in:
48
commons/class/list.js
Normal file
48
commons/class/list.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import {
|
||||
reactive, ref
|
||||
} from 'vue';
|
||||
function isSameType(a, b) {
|
||||
return a instanceof b === true || b instanceof a === true;
|
||||
}
|
||||
class LIST{
|
||||
constructor(data) {
|
||||
this.data=reactive({
|
||||
page:0,
|
||||
totalPage:0,
|
||||
total:0,
|
||||
list:[],
|
||||
hasAjax:false,
|
||||
status:'',//loading fail success
|
||||
query:{
|
||||
|
||||
}
|
||||
})
|
||||
Object.assign(this.data, data)
|
||||
}
|
||||
add(item){
|
||||
this.data.list.push(item)
|
||||
}
|
||||
del(index){
|
||||
this.data.list.splice(index,1)
|
||||
}
|
||||
update(index,item){
|
||||
this.data.list[index]=item
|
||||
}
|
||||
get(index){
|
||||
return this.data.list[index]
|
||||
}
|
||||
getVal(key){
|
||||
return this.data[key]
|
||||
}
|
||||
setQuery(key,val){
|
||||
this.data.query[key]=val
|
||||
}
|
||||
setVal(key,val){
|
||||
this.data[key]=val
|
||||
if(key=='page'){
|
||||
this.data['page']=val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default LIST
|
||||
Reference in New Issue
Block a user