mt-tabbar切换错误: Cannot read property 'match' of null

发布于 2022-09-11 15:12:49 字数 2580 浏览 9 评论 0

使用Mint-UI中的Tabbar时,出现Uncaught TypeError: Cannot read property 'match' of null错误。

UI图:
图片描述

在点击tabbar切换tab时出现如下错误:

VM3871:1 Uncaught TypeError: Cannot read property 'match' of null
    at U (<anonymous>:1:238)
    at cn (<anonymous>:1:297)
U @ VM3871:1
cn @ VM3871:1
VM3871:1 Uncaught TypeError: Cannot read property 'match' of null
    at U (<anonymous>:1:238)
    at an (<anonymous>:1:412)
U @ VM3871:1
an @ VM3871:1
VM3871:1 Uncaught TypeError: Cannot read property 'match' of null
    at U (<anonymous>:1:238)
    at en (<anonymous>:1:527)
U @ VM3871:1
en @ VM3871:1
VM3871:1 Uncaught TypeError: Cannot read property 'match' of null
    at U (<anonymous>:1:238)
    at cn (<anonymous>:1:297)
U @ VM3871:1
cn @ VM3871:1
VM3871:1 Uncaught TypeError: Cannot read property 'match' of null
    at U (<anonymous>:1:238)
    at an (<anonymous>:1:412)
U @ VM3871:1
an @ VM3871:1
VM3871:1 Uncaught TypeError: Cannot read property 'match' of null
    at U (<anonymous>:1:238)
    at en (<anonymous>:1:527)

调用代码如下:

<template>
    <div>
        <router-view></router-view>
        <mt-tabbar fixed v-model="selected">
            <mt-tab-item id="tab1" @click.native="goTo('/main/home')">
                <img slot="icon" src="../assets/logo.png">
                首页
            </mt-tab-item>
            <mt-tab-item id="tab2" @click.native="goTo('/main/info')">
                <img slot="icon" src="../assets/logo.png">
                发现
            </mt-tab-item>
            <mt-tab-item id="tab3" @click.native="goTo('/main/learning')">
                <img slot="icon" src="../assets/logo.png">
                交流
            </mt-tab-item>
            <mt-tab-item id="tab4" @click.native="goTo('/main/industry')">
                <img slot="icon" src="../assets/logo.png">
                我的
            </mt-tab-item>
        </mt-tabbar>
    </div>
</template>

<script>
    export default {
        name: "Main",
        methods: {
            goTo(path) {
                this.$router.replace(path);
            }
        },
        data() {
            return {
                selected: "tab4",
            }
        }
    }
</script>

<style scoped>

</style>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文