feat: 回车检测&restore添加标签
This commit is contained in:
@@ -4,12 +4,16 @@
|
||||
<div class="btn" @click="versionTreeData.drawer = true">Version Tree</div>
|
||||
</div>
|
||||
<div class="content-wrapper">
|
||||
<Agent :title="agentTitle" @update:sketchList="updateSketchList" />
|
||||
<Agent ref="agentRef" :title="agentTitle" @update:sketchList="updateSketchList" />
|
||||
<div class="preview-wrapper">
|
||||
<Preview :type="previewType" :sketchList="sketchList" />
|
||||
</div>
|
||||
</div>
|
||||
<VersionTreeIndex ref="VersionTreeIndexRef" v-model:versionTreeData="versionTreeData" />
|
||||
<VersionTreeIndex
|
||||
ref="VersionTreeIndexRef"
|
||||
v-model:versionTreeData="versionTreeData"
|
||||
@restore="handleRestore"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -21,12 +25,11 @@
|
||||
import { useProjectStore } from '@/stores'
|
||||
import { getProjectInfo } from '@/api/agent'
|
||||
|
||||
|
||||
const agentTitle = ref('Retro Sofa Sketch')
|
||||
const previewType = ref<'sketch' | 'report'>('sketch')
|
||||
|
||||
const VersionTreeIndexRef = ref()
|
||||
|
||||
const agentRef = ref()
|
||||
const sketchList = ref([])
|
||||
const updateSketchList = (newVal) => {
|
||||
console.log('newVal', newVal)
|
||||
@@ -35,21 +38,30 @@
|
||||
}
|
||||
|
||||
const versionTreeData = ref({
|
||||
drawer: false,
|
||||
drawer: false
|
||||
})
|
||||
|
||||
const handleRestore = () => {
|
||||
console.log('-----------', agentRef.value.inputRef.addReportTag)
|
||||
|
||||
agentRef.value?.inputRef?.addReportTag('Restore')
|
||||
}
|
||||
|
||||
const projectStore = useProjectStore()
|
||||
watch(()=>projectStore.state.id, (newVal, oldVal) => {
|
||||
if(newVal){
|
||||
getProjectInfo({ id: newVal }).then(res => {
|
||||
projectStore.setProject(res.project)
|
||||
})
|
||||
watch(
|
||||
() => projectStore.state.id,
|
||||
(newVal, oldVal) => {
|
||||
if (newVal) {
|
||||
getProjectInfo({ id: newVal }).then((res) => {
|
||||
projectStore.setProject(res.project)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
onMounted(()=>{
|
||||
if(projectStore.state.id){
|
||||
getProjectInfo({ id: projectStore.state.id }).then(res => {
|
||||
onMounted(() => {
|
||||
if (projectStore.state.id) {
|
||||
getProjectInfo({ id: projectStore.state.id }).then((res) => {
|
||||
projectStore.setProject(res.project)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user