VM1350:9 app.js错误:
TypeError: common_vendor.defineStore is not a function
at user.js? [sm]:3
at WASubContext.js?t=wechat&s=1691162871868&v=3.0.0:1
at d.runWith (WASubContext.js?t=wechat&s=1691162871868&v=3.0.0:1)
at V (WASubContext.js?t=wechat&s=1691162871868&v=3.0.0:1)
at n (WASubContext.js?t=wechat&s=1691162871868&v=3.0.0:1)
at uni-fetch.js? [sm]:3
at WASubContext.js?t=wechat&s=1691162871868&v=3.0.0:1
at d.runWith (WASubContext.js?t=wechat&s=1691162871868&v=3.0.0:1)
at V (WASubContext.js?t=wechat&s=1691162871868&v=3.0.0:1)
at n (WASubContext.js?t=wechat&s=1691162871868&v=3.0.0:1)(env: Windows,mp,1.06.2306020; lib: 3.0.0)
pc端正常运行----抒写:
import { defineStore } from 'pinia';
import { ref } from 'vue'
export const useUserStore = defineStore(
'user',
() => {
const token = ref('')
const newToken = (value) => {
token.value = value
}
return { token, newToken }
}, {
persist: {
paths: ['token'],
},
}
)
微信小程序解析::
"use strict";
const common_vendor = require("../common/vendor.js");
const useUserStore = common_vendor.defineStore(
"user",
() => {
const token = common_vendor.ref("");
const newToken = (value) => {
token.value = value;
};
return { token, newToken };
},
{
persist: {
paths: ["token"]
}
}
);
exports.useUserStore = useUserStore;
都是 pinia仓库-- user.js文件,
pc正常运行,微信小程序编译 保存 说common_vendor.defineStore is not a function 不是一个函数?
1 个回复
aboutlikefish
同问,莫名其妙的bug