<template> <nav class="mui-bar mui-bar-tab"> <router-link class="mui-tab-item-lib" :to="{name:'home'}"> <span class="mui-icon mui-icon-home"></span> <span class="mui-tab-label">首页</span> </router-link> <router-link class="mui-tab-item-lib" :to="{name:'category'}"> <span class="mui-icon mui-icon-personadd"></span> <span class="mui-tab-label">分类</span> </router-link> <router-link class="mui-tab-item-lib" :to="{name:'shopcart'}"> <span class="mui-icon mui-icon-extra mui-icon-extra-cart"> <span class="mui-badge">2</span> </span> <span class="mui-tab-label">购物车</span> </router-link> <router-link class="mui-tab-item-lib" :to="{name:'user'}"> <span class="mui-icon mui-icon-gear"></span> <span class="mui-tab-label">我的</span> </router-link> </nav> </template>
时间: 2023-08-13 20:51:43 浏览: 188
这是一个 Vue.js 的组件模板,它定义了一个基于路由的导航栏,包含四个链接,分别是首页、分类、购物车和我的。这个导航栏使用了 MUI 框架的样式,并且在购物车链接中展示了一个徽章,表示当前购物车中有 2 件商品。每个链接使用了 Vue Router 的<router-link>组件,并通过v-bind指令动态绑定了链接的目标路由地址。
相关问题
<template> <nav class="mui-bar mui-bar-tab"> <router-link class="mui-tab-item-lib" :to="{name: 'home'}"> <span class="mui-icon mui-icon-home"></span> <span class="mui-tab-label">首页</span> </router-link> <router-link class="mui-tab-item-lib" :to="{name: 'category'}"> <span class="mui-icon mui-icon-personadd"></span> <span class="mui-tab-label">分类</span> </router-link> <router-link class="mui-tab-item-lib" :to="{name: 'shopcart'}"> <span class="mui-icon mui-icon-extra mui-icon-extra-cart"> <span class="mui-badge">2</span> </span> <span class="mui-tab-label">购物车</span> </router-link> <router-link class="mui-tab-item-lib" :to="{name: 'user'}"> <span class="mui-icon mui-icon-gear"></span> <span class="mui-tab-label">我的</span> </router-link> </nav> </template>报错:D:\Vue\cli\vue_shop\src\components\tabbar.vue 1:1 error Component name "tabbar" should always be multi-word vue/multi-word-component-names
这个错误是Lint提示的,它认为你的组件名 "tabbar" 只有一个单词,不符合Vue的组件命名规范,建议你将组件名改成 "TabBar" 或者 "TabBarView" 等多个单词组成的名称,以解决这个错误。如果你不想修改组件名,可以在ESLint配置文件中添加 "vue/multi-word-component-names": "off" 以禁用这个规则。
<template> <div class="home"> <div class="top"> <mt-swipe :auto="3000"> <mt-swipe-item> <img src="../assets/images/s1.jpg" alt /> </mt-swipe-item> <mt-swipe-item> <img src="../assets/images/s2.jpg" alt /> </mt-swipe-item> <mt-swipe-item> <img src="../assets/images/s3.jpg" alt /> </mt-swipe-item> </mt-swipe> </div> <div class="mui"> <div class="ll"> <el-row type="flex" class="row-bg" justify="space-between"> <el-col :span="6"> <router-link :to="{ name: 'news_list' }" class="title"> <img src="../assets/images/menu1.png" alt=""> <div class="grid-content bg-purple">新闻资讯</div> </router-link> </el-col> <el-col :span="6"> <router-link :to="{ name: 'photo_list' }" class="title"> <img src="../assets/images/menu2.png" alt=""> <div class="grid-content bg-purple-light">图片分享</div> </router-link> </el-col> <el-col :span="6"> <img src="../assets/images/menu3.png" alt=""> <div class="grid-content bg-purple">商品购买</div> </el-col> </el-row> </div> <div class="kk"> <el-row type="flex" class="row-bg" justify="space-between"> <el-col :span="6"> <img src="../assets/images/menu4.png" alt=""> <div class="grid-content bg-purple">留言反馈</div> </el-col> <el-col :span="6"> <img src="../assets/images/menu5.png" alt=""> <div class="grid-content bg-purple-light">视频专区</div> </el-col> <el-col :span="6"> <img src="../assets/images/menu6.png" alt=""> <div class="grid-content bg-purple">联系我们</div> </el-col> </el-row> </div> </div> </div> </template> <script>
这是一个Vue.js的组件,包含一个顶部的图片轮播和一个菜单区域。图片轮播使用了第三方组件mt-swipe,菜单区域使用了Element UI的el-row和el-col组件。其中新闻资讯和图片分享使用了Vue Router的router-link组件进行路由跳转。留言反馈、视频专区、联系我们暂未添加路由跳转。
阅读全文