import { defineStore } from "pinia"; import axios from "axios"; import {nanoid} from 'nanoid'; export const useTalkStore = defineStore("talk1", { state() { return { // list: [ // { id: "01", content: "今天你有点怪,哪里怪?怪好看的!" }, // { id: "02", content: "草莓、蓝莓、蔓越莓,今天想我了没?" }, // { id: "03", content: "心里给你留了一块地,我的死心塌地" }, // ], list: JSON.parse(localStorage.getItem('newList')) || [] }; }, actions:{ // [ // "你知道我的缺点是什么吗?是缺点你。", // "我最近有点忙,忙什么?忙着喜欢你。", // "你知道我为什么感冒了吗?因为我对你完全没有抵抗力。", // "你知道我的心在哪边吗?左边啊。不,在你那边。", // "我想去取一下东西,你等一下,我来娶你了。" // ] getMain() { // axios.get('http://localhost:3000/api/pick-up-line').then(res => { // console.log(res,'數據') // }) // let data = await axios.get("https://api.deepseek.com/tuwei?type=love&count=1"); // try {}catch { } let obj = { id:nanoid(), content:"你知道我的缺点是什么吗?是缺点你。" } this.list.push(obj); } } });