前端Vue自定义精美宫格菜单按钮组件 可设置一行展示个数 可设置成九宫格 十二宫格 十五宫格_天天新视野
2023-07-04 09:20:30来源:博客园
(资料图片仅供参考)
前端Vue自定义精美宫格菜单按钮组件 可设置一行展示个数 可设置成九宫格 十二宫格 十五宫格 , 下载完整代码请访问uni-app插件市场地址:https://ext.dcloud.net.cn/plugin?id=13315
效果图如下:
cc-categoryMenu
使用方法
十五宫格菜单 十二宫格菜单 九宫格菜单
HTML代码实现部分
十五宫格菜单 十二宫格菜单 九宫格菜单 <script>export default {data() {return {categoryList: [{id: 1,name: "红萝卜",img: "https://cdn.pixabay.com/photo/2014/12/21/23/34/carrot-575529_1280.png"}, {id: 2,name: "蔬菜",img: "https://cdn.pixabay.com/photo/2012/04/24/16/15/broccoli-40295_1280.png"}, { //分类列表id: 3,name: "汉堡",img: "https://cdn.pixabay.com/photo/2012/04/13/01/51/hamburger-31775_1280.png"}, {id: 4,name: "羊皮纸",img: "https://cdn.pixabay.com/photo/2013/07/12/17/19/diploma-152024_1280.png"},{id: 5,name: "香蕉",img: "https://cdn.pixabay.com/photo/2014/04/03/11/07/bananas-311788_1280.png"}, {id: 6,name: "奶油草莓",img: "/static/images/class/food-strawberry.png"}, {id: 7,name: "柠檬",img: "https://cdn.pixabay.com/photo/2013/07/12/17/41/lemon-152227_1280.png"}, {id: 8,name: "热狗",img: "/static/images/class/food-hotdog.png"}, {id: 9,name: "披萨",img: "/static/images/class/food-pizza.png"}, {id: 10,name: "蛋黄酥",img: "/static/images/class/food-eggyolkcake.png"}],}},onLoad() {},methods: {menuClick: function(item) {console.log("点击菜单条目item = " + JSON.stringify(item));uni.showModal({title: "点击菜单条目",content: "点击菜单条目item = " + JSON.stringify(item)})},}}</script>
关键词: