Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store动态挂载无效 #215

Open
ZeroZero-0 opened this issue Jul 12, 2021 · 0 comments
Open

store动态挂载无效 #215

ZeroZero-0 opened this issue Jul 12, 2021 · 0 comments

Comments

@ZeroZero-0
Copy link

`import { Action, getModule, Module, Mutation, VuexModule } from "vuex-module-decorators";
import store from "@/store";

export interface IProductPlanState {
totalCount: number,
currentPage: number,
pageSize: number,
list:any[],
loading: boolean,
TempList:any[],
}
@module({dynamic:true,store, name:'ProductPlanModule' })
class ProductPlanModule extends VuexModule implements IProductPlanState {

totalCount = 0
currentPage = 1
pageSize = 15
list: any[]
loading = false
TempList: any[]

@Mutation
setCurrentPage( page: number) {
  this.currentPage = page
} 
@Mutation
setPageSize( pagesize: number) {
  this.pageSize = pagesize
} 
@Mutation
setSkiPage( pageRequest: any) {
  this.loading = true
  let selecttop = []
  const startPosition = pageRequest.skipCount
  const endPosition = pageRequest.skipCount + this.pageSize
  if (endPosition > this.TempList.length) {
    selecttop = this.TempList.slice(
      startPosition,
      this.TempList.length,
    )
    // for(let i=startPosition;i<state.TempList.length;i++){
    //     selecttop.push(state.TempList[i]);
    // }
  } else {
    selecttop = this.TempList.slice(startPosition, endPosition)
    // for(let i=startPosition;i<endPosition;i++){
    //     selecttop.push(state.TempList[i]);
    // }
  }
  this.loading = false
  this.list = selecttop
} 

}
export const productplanModule = getModule(ProductPlanModule,store)
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant