1***@139.com
1***@139.com
  • 发布:2023-08-05 00:00
  • 更新:2023-08-10 11:45
  • 阅读:798

HBuuilderX编译微信小程序错误TypeError: common_vendor.defineStore is not a function

分类:HBuilderX

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 不是一个函数?

2023-08-05 00:00 负责人:无 分享
已邀请:
aboutlikefish

aboutlikefish

同问,莫名其妙的bug

要回复问题请先登录注册