talk.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { defineStore } from "pinia";
  2. import axios from "axios";
  3. import {nanoid} from 'nanoid';
  4. export const useTalkStore = defineStore("talk1", {
  5. state() {
  6. return {
  7. // list: [
  8. // { id: "01", content: "今天你有点怪,哪里怪?怪好看的!" },
  9. // { id: "02", content: "草莓、蓝莓、蔓越莓,今天想我了没?" },
  10. // { id: "03", content: "心里给你留了一块地,我的死心塌地" },
  11. // ],
  12. list: JSON.parse(<string>localStorage.getItem('newList')) || []
  13. };
  14. },
  15. actions:{
  16. // [
  17. // "你知道我的缺点是什么吗?是缺点你。",
  18. // "我最近有点忙,忙什么?忙着喜欢你。",
  19. // "你知道我为什么感冒了吗?因为我对你完全没有抵抗力。",
  20. // "你知道我的心在哪边吗?左边啊。不,在你那边。",
  21. // "我想去取一下东西,你等一下,我来娶你了。"
  22. // ]
  23. getMain() {
  24. // axios.get('http://localhost:3000/api/pick-up-line').then(res => {
  25. // console.log(res,'數據')
  26. // })
  27. // let data = await axios.get("https://api.deepseek.com/tuwei?type=love&count=1");
  28. // try {}catch { }
  29. let obj = {
  30. id:nanoid(),
  31. content:"你知道我的缺点是什么吗?是缺点你。"
  32. }
  33. this.list.push(obj);
  34. }
  35. }
  36. });