// components/diy-tabs/index.js Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { style: { activebgColor: "#fff", activeHeight: 88 / 2, activeColor: "#E43F81 !important", activePadding: 40 / 2, tabsHeight: 40, tabsBackground: "linear-gradient(270deg, #E74B77 0%, #EC355C 100%)", selectedX: 10, selectedY: 10, tabBorderRadius: 12, tabFontSize: 14, tabColor: "#fff;", tabMarginLeft: 20, }, selected: 0, scrollItem: [ { id: 0, name: "全部" }, { id: 1, name: "面部护理" }, { id: 2, name: "精致彩妆" }, { id: 3, name: "迷人香水" }, { id: 4, name: "洗发护发" } ] }, /** * 组件的方法列表 */ methods: { selected(e) { console.log(e); let id = e.currentTarget.dataset.item; this.setData({ selected: id, }); }, } })