Files
MBTI_wang/miniprogram/components/result-section-nav/index.js

24 lines
768 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// components/result-section-nav/index.js
// 结果页顶部分类锚点导航:横向 chip 条,点击触发 navtap 事件,由页面 scroll-into-view 接管跳转
Component({
options: {
addGlobalClass: true,
multipleSlots: false
},
properties: {
// [{ id: 'sec-insight', label: '洞察', emoji: '🧠' }, ...]
sections: { type: Array, value: [] },
// 当前高亮的 section id可选暂未接滚动联动
active: { type: String, value: '' },
// 色系锚点purple / blue / orange / teal对应 MBTI/DISC/PDP/SBTI
theme: { type: String, value: 'purple' }
},
methods: {
onTap(e) {
const id = e.currentTarget.dataset.id
if (!id) return
this.triggerEvent('navtap', { id })
}
}
})