此项目采用uniapp vite+vue3+ts项目
不管哪种方式使用插件都报相同的错误
以下是npm安装的报错信息:
npm install uni-lb-picker 安装之后报错信息如下
VM547:5489 页面【node-modules/uni-lb-picker/components/lb-picker/pickers/date-selector-picker]错误:
Error: module 'node-modules/uni-lb-picker/components/lb-picker/lib/dayjs.min.js' is not defined, require args is '../lib/dayjs.min.js'
at q (WASubContext.js?t=wechat&s=1686049868574&v=2.32.1:1)
at n (WASubContext.js?t=wechat&s=1686049868574&v=2.32.1:1)
at date-selector-picker.js?t=wechat&s=1686049868574&v=6735c940dd200317f73956e3b8158665:1
at WASubContext.js?t=wechat&s=1686049868574&v=2.32.1:1
at f.runWith (WASubContext.js?t=wechat&s=1686049868574&v=2.32.1:1)
at q (WASubContext.js?t=wechat&s=1686049868574&v=2.32.1:1)
at <anonymous>:5486:7
at doWhenAllScriptLoaded (<anonymous>:6193:21)
at Object.scriptLoaded (<anonymous>:6221:5)
at Object.<anonymous> (<anonymous>:6246:22)(env: Windows,mp,1.06.2304191; lib: 2.32.1)
这是使用时的代码
<template>
<div @click="open">请选择{{ value }}</div>
<lb-picker
ref="RefPicker2"
v-model="value"
mode="multiSelector"
:list="localdata"
:level="level"
:dataset="dataset"
@change="handleChange"
@confirm="handleConfirm"
@cancel="handleCancel"
>
</lb-picker>
</template>
<script setup lang="ts" name="CustomSelectionCity2">
import LbPicker from "uni-lb-picker";
import localdata from "@/utils/localdata";
interface PropsType {
defaultValName?: any;
defaultValCode?: any;
dataset?: any;
level?: number;
}
const { defaultValName, defaultValCode, dataset, level } = withDefaults(
defineProps<PropsType>(),
{
defaultValName: [],
defaultValCode: [],
dataset: {
name: "lable",
value: "value",
},
level: 2,
}
);
const RefPicker2 = ref<any>(null);
const value = ref<any>([]);
const open = () => {
RefPicker2.value && RefPicker2.value.show();
};
const close = () => {
RefPicker2.value && RefPicker2.value.hide();
};
const handleChange = () => {};
const handleConfirm = () => {};
const handleCancel = () => {};
defineExpose({
open,
close,
});
</script>
1 个回复
sssKKwater - 哈哈
哥们解决了吗