Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0125· OpenAIAi2 WildChat-4.8M (AI2)

mounted() { this.fetchList() CreateSetModule.resetFields() } async fetchList() { try {…

  1. User

    mounted() { this.fetchList() CreateSetModule.resetFields() }

    async fetchList() {
      try {
        await Project.fetchAllFProjects()
        this.isLoaded = true
      } catch (err) {
        console.log(err)
      }
    }
    

    переписать на vue 3 composition api

  2. Assistant

    import { ref, onMounted } from 'vue' import Project from 'path/to/Project' import CreateSetModule from 'path/to/CreateSetModule'

    export default { setup() { const isLoaded = ref(false)

    const fetchList = async () => {
      try {
        await Project.fetchAllFProjects()
        isLoaded.value = true
      } catch (err) {
        console.log(err)
      }
    }
    
    const mounted = () => {
      fetchList()
      CreateSetModule.resetFields()
    }
    
    onMounted(mounted)
    
    return {
      isLoaded
    }
    

    } }

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.