夫子仰慕者
夫子仰慕者
  • 发布:2023-08-24 10:32
  • 更新:2024-01-09 01:18
  • 阅读:337

【报Bug】nvue中使用<list><cell>就会警告

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: iOS13

HBuilderX类型: 正式

HBuilderX版本号: 3.8.12

手机系统: Android

手机系统版本号: Android 10

手机厂商: 华为

手机机型: 荣耀

页面类型: nvue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:

必现

预期结果:

不要出现这个红色的警告

实际结果:

还是每次必现

bug描述:

在nvue页面使用 <list <cell v-for="item in planData" :key="item.id"> <itemView @goJumpPage="goTo" @handleCouponClick="handleCoupon" item="item"/> </cell>
就会报下面的警告实在是找不到原因

[Vue warn]: Unknown custom element: <cell> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

2023-08-24 10:32 负责人:无 分享
已邀请:
爱豆豆

爱豆豆 - 办法总比困难多

你是怎么使用的呢 能提供个demo吗

  • 夫子仰慕者 (作者)

    <template>  
    <view class="s_page">
    <text class="f28_333">正在使用的Wifi</text>
    <view class="container" style="height: 100rpx;">
    <view class="cell" style="border-bottom-width: 0;">
    <text class="f24_333">一楼无线局域网</text>
    <text class="f24_49C">已连接</text>
    </view>
    </view>
    <view class="title">
    <text class="f28_333" style="margin-bottom: 0;">获取设备附近的WLAN</text>
    <image class="reresh ml40" src="/static/image/refresh.png" mode=""></image>
    </view>
    <list class="container">
    <refresh @pullingdown='onpullingdown' @refresh="onrefresh" :display=" refreshing ? 'show' : 'hide' " class="refresh">
    <text>{{refreshText}}</text>
    <loading-indicator></loading-indicator>
    </refresh>
    <cell v-for="(item,index) in list" :key="index">
    <view class="cell" :style=" index == list.length-1 ? 'border-bottom-width:0' : '' ">
    <text class="f24_333 flex-1">一楼无线局域网</text>
    <image class="icon" src="/static/image/wlan/w1.png"></image>
    <image class="icon" src="/static/image/wlan/lock.png"></image>
    </view>
    </cell>
    </list>
    </view>

    </template>


    <script>

    export default {

    data() {

    let list = []

    for (let i = 0; i < 100; i++) {

    list.push(i);

    }

    return {

    list,

    refreshing: false,

    refreshText: '↓ Pull To Refresh'

    };

    },

    methods: {

    onpullingdown(e) {

    if (this.refreshing) return;

    if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) {

    this.refreshText = '↑ Pull To Refresh'

    } else {

    this.refreshText = '↓ Pull To Refresh'

    }

    },

    onrefresh(e) {

    if (this.refreshing) return;

    this.refreshing = true;

    setTimeout(() => {

    this.refreshing = false;

    this.refreshText = '↓ Pull To Refresh'

    }, 3000)

    }

    }

    }

    </script>

    2023-08-24 11:28

  • 夫子仰慕者 (作者)

    <template>

    <view class="tabs">

    <list class="scroll-v list"

    scrollable='true'

    enableBackToTop="true"

    scroll-y

    loadmoreoffset="15" >

    <cell v-for="(newsitem,index2) in tabBars" :key="index2">

    <view style="width:750rpx;height: 80rpx;background-color: aquamarine;padding: 10rpx;">{{newsitem.name}}</view>

    </cell>

    <cell class="loading-more" >

    <text class="loading-more-text">fdfd</text>

    </cell>

    </list>

    </view>

    </template>


    <script>

    export default {

    data () {

    return {

    dataList: [{id: "1", name: 'A'}, {id: "2", name: 'B'}, {id: "3", name: 'C'}],

    tabBars: [{

    name: '关注',

    id: 'guanzhu'

    }, {

    name: '推荐',

    id: 'tuijian'

    }, {

    name: '体育',

    id: 'tiyu'

    }, {

    name: '热点',

    id: 'redian'

    }, {

    name: '财经',

    id: 'caijing'

    }, {

    name: '娱乐',

    id: 'yule'

    }, {

    name: '军事',

    id: 'junshi'

    }, {

    name: '历史',

    id: 'lishi'

    }, {

    name: '本地',

    id: 'bendi'

    },{

    name: '关注',

    id: 'guanzhu'

    }, {

    name: '推荐',

    id: 'tuijian'

    }, {

    name: '体育',

    id: 'tiyu'

    }, {

    name: '热点',

    id: 'redian'

    }, {

    name: '财经',

    id: 'caijing'

    }, {

    name: '娱乐',

    id: 'yule'

    }, {

    name: '军事',

    id: 'junshi'

    }, {

    name: '历史',

    id: 'lishi'

    }, {

    name: '本地',

    id: 'bendi'

    },{

    name: '关注',

    id: 'guanzhu'

    }, {

    name: '推荐',

    id: 'tuijian'

    }, {

    name: '体育',

    id: 'tiyu'

    }, {

    name: '热点',

    id: 'redian'

    }, {

    name: '财经',

    id: 'caijing'

    }, {

    name: '娱乐',

    id: 'yule'

    }, {

    name: '军事',

    id: 'junshi'

    }, {

    name: '历史',

    id: 'lishi'

    }, {

    name: '本地',

    id: 'bendi'

    }],

    }

    }

    }

    </script>

    2023-08-24 11:28

  • 夫子仰慕者 (作者)

    我在hellouniapp里面运行又不报错,是不是哪里需要做下配置,但是文档又没提这事儿

    2023-08-24 11:29

  • 爱豆豆

    回复 x***@163.com: 这俩页面单独运行后 没发现报错啊 你弄个空项目 压缩一下发出来 我在试试

    2023-08-24 17:32

1***@163.com

1***@163.com - 在技术的道路上缓慢前进

你这是一个组件么,这警告是,你定义了一个组件,但是没有给这个组件一个name标识

  • 夫子仰慕者 (作者)

    但是这个是系统的原生组件啊

    2023-08-24 13:44

  • 1***@163.com

    回复 x***@163.com: 我说你那个用了list的那个文件,是不是一个组件,还是一个页面

    2023-08-24 13:55

2***@qq.com

2***@qq.com

遇到了一样的问题,原生组件不识别,大佬这个后面解决了嘛?

要回复问题请先登录注册