How to Solve pinia Error in ts File

How To Solve Pinia Error In Ts File

getActivePinia was known as with no lively Pinia. Did you overlook to set up pinia

1. Create the shop.ts file

import { createPinia } from "pinia";

const retailer = createPinia();

export { retailer };

2、 Introduced in foremost.ts

import { createApp } from "vue";
import "./style.css";
import "./main.css";
import App from "./App.vue";
import ElementPlus from "element-plus";
import Avue from "@smallwei/avue";
import "@smallwei/avue/lib/index.css";
import "@/assets/css/mapbox-gl.css";
import { retailer } from "@/pinia/index";    // Introduce the created pinia
import router from "@/router/index";
import "element-plus/dist/index.css";

const app = createApp(App);

app.use(retailer);  // use pinia

3、 Create your individual Pinia file

import { defineStore } from "pinia";

interface State {
  nodeArr: any[] | [];
  stencilLoading: boolean;
  chooseNodeId: quantity;
  lcNodeKnowledge: LCDataType | {}

const defaultState: State = {
  nodeArr: [], // Node knowledge in the drag and drop bar
  stencilLoading: true, // Loading of the drag bar
  chooseNodeId: -1, // The node id of the chosen drag bar
  lcNodeKnowledge: {}, // The LC knowledge in the chosen canvas

export const lcDataStore = defineStore("lcData", {
  state: () => {
    return defaultState;
  getters: {},
  actions: {},

4、 Using Pinia in the TS file

import { lcDataStore } from "@/pinia/lcAssign";
import { retailer } from "@/pinia/index";

const lcStore = lcDataStore(retailer);   // Here you've to cross in the shop

// After that, you need to use the properties and strategies contained in the lcStore

pymysql Error: File “/usr/local/lib/python2.7/site-packages/PyMySQL-1.0.2-py2.7.egg/pymysql/”, line 167 SyntaxError: invalid syntax

raceback (most up-to-date name final): File "", line 49, in <module> db = create_engine("mysql+pymysql://root:{m_pass}@".format(m_pass=m_pass)) File "<string>", line 2, in create_engine File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/", line 309,...
Avatar Of Budi Setiawan Budi Setiawan
31 sec read

Leave a Reply

Your email address will not be published. Required fields are marked *