<script>
export default {
  data() {
    return {
      prompt: "",
      responseData: "",
      loading: false
    };
  },
  methods: {
    submitData() {
      uni.showLoading({
        title: "正在加载中..."
      }); // 显示等待框
      this.loading = true;
      uni.request({
        url: "https://svip1-api.cveoy.top/v3/completions", // 假设接口地址为 http://localhost:3000/data
        method: "POST",
        data: {
          prompt: this.prompt,
          keys: "sk-c6e3c04b15af4afd933f4d15282ed524"
        },
        success: res => {
          this.responseData = JSON.stringify(res.data);
        },
        complete: () => {
          this.loading = false;
          uni.hideLoading(); // 隐藏等待框
        }
      });
    }
  }
};
</script
scriptexport default data return prompt responseData loading false ; methods submitData thisloading = true; 显示等待框 unirequest url httpssvip1-apicveo

原文地址: https://www.cveoy.top/t/topic/crFu 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录