Files
lanecarford_front/src/stores/modules/generate.ts
2025-10-21 13:46:27 +08:00

41 lines
913 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 每一个存储的模块命名规则use开头store结尾
import { defineStore } from 'pinia'
export const useGenerateStore = defineStore({
id: 'generate', // 必须指明唯一的pinia仓库的id
state: () => {
return {
userData:{
title: '123123',
name: '123123',
describe: '',
id:'',
style:{
id:-1,
oldId:-1,//表示从生成页面返回回来需要调整的样式id
},
},
queryList:[]
}
},
getters: {
// doubleCount: (state) => state.num * 2
},
actions: {
selectStyle(data:any) {
this.userData.style.id = data.id
console.log(this.userData)
},
//生成后去掉id 设置oldId来修改样式
useStyleGenerate(){
this.userData.style.oldId = this.userData.style.id
this.userData.style.id = -1
},
updateStyle(data){
console.log(data)
if(data.id == this.userData.style.oldId){
this.userData.style.oldId = -1
}
}
}
})