系统版本: macOS Catalina 10.15.7,
微信开发者工具版本: wechat_devtools_1.05.2110110 、 wechat_devtools_1.05.2201240,
nutUI版本: "@nutui/nutui-taro": "^3.1.8",
taro版本: "@tarojs/taro": "3.4.0",
vue版本: "vue": "^3.0.0",
在taro vue3环境中使用nutUI, Picker组件,报错: [Vue warn]: Failed to resolve component: picker,
相同环境运行其他组件正常。picker组件updated正常。
updated Proxy {0: {…}, 1: {…}, 2: {…}, 3: {…}, 4: {…}, 5: {…}, 6: {…}, 7: {…}, 8: {…}, 9: {…}, 10: {…}, 11: {…}, 12: {…}, 13: {…}, 14: {…}, 15: {…}, 16: {…}, 17: {…}, 18: {…}, 19: {…}, 20: {…}, 21: {…}, 22: {…}, 23: {…}, 24: {…}, 25: {…}, 26: {…}, 27: {…}, 28: {…}, 29: {…}, 30: {…}}
代码片段:
app.ts
App.use(Button).use(Toast).use(Picker).use(Popup).use(Cell)
import { Button, Toast, Picker, Popup, Cell } from '@nutui/nutui-taro';
index/index.vue
<template>
<nut-cell title="请选择城市" :desc="desc" @click="open"></nut-cell>
<nut-picker
v-model:visible="show"
:list-data="listData"
title="城市选择"
@confirm="confirm"
></nut-picker>
</template>
<script>
import { ref } from 'vue';
export default {
setup(props) {
const show = ref(false);
const listData = [
'南京市',
'无锡市',
'海北藏族自治区',
'北京市',
'连云港市',
'浙江市',
'江苏市'
];
const desc = ref(listData[0]);
const open = ()=>{
show.value = true;
}
const confirm = (res)=>{
desc.value = res;
}
return {show,desc,listData,open, confirm};
}
};
</script>
报错信息:
[Vue warn]: Failed to resolve component: picker
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <NutPicker visible=false onUpdate:visible=fn list-data=