|
1 month ago | |
---|---|---|
.. | ||
README.md | 1 month ago | |
chapterPopup.vue | 1 month ago | |
novelVotePopup.vue | 1 month ago | |
subscriptionPopup.vue | 1 month ago |
本目录包含小说阅读页面使用的各种公共组件,所有组件都支持暗色主题模式。
中心弹出的订阅章节提示弹窗。
<template>
<subscriptionPopup ref="subscriptionPopup" @subscribe="handleSubscribe"/>
</template>
<script>
import subscriptionPopup from 'pages_order/components/novel/subscriptionPopup.vue'
export default {
components: {
subscriptionPopup
},
methods: {
showSubscriptionPopup() {
this.$refs.subscriptionPopup.open()
},
handleSubscribe() {
// 处理订阅事件
}
}
}
</script>
从底部弹出的支付方式选择弹窗。
<template>
<paymentPopup ref="paymentPopup" @subscribe="handleSubscribe" @close="handleClose"/>
</template>
<script>
import paymentPopup from 'pages_order/components/novel/paymentPopup.vue'
export default {
components: {
paymentPopup
},
methods: {
showPaymentPopup() {
this.$refs.paymentPopup.open()
},
handleSubscribe() {
// 处理订阅事件
},
handleClose() {
// 处理关闭事件
}
}
}
</script>
显示小说章节列表的弹窗。
<template>
<chapterPopup ref="chapterPopup"/>
</template>
<script>
import chapterPopup from 'pages_order/components/novel/chapterPopup.vue'
export default {
components: {
chapterPopup
},
methods: {
showChapterList() {
this.$refs.chapterPopup.open()
}
}
}
</script>
用于评价小说的弹窗组件。
所有组件都支持暗色主题模式,当系统切换到暗色模式或用户手动切换时,组件会自动应用暗色样式。
主题的状态保存在Vuex中,可以通过以下方式切换:
// 切换主题模式
this.$store.commit('toggleThemeMode')
// 设置为特定模式
this.$store.commit('setThemeMode', 'dark') // 或 'light'
// 获取当前主题模式
const isDarkMode = this.$store.getters.isDarkMode
为了方便在组件中使用主题相关功能,可以引入主题混入器:
import themeMixin from '@/mixins/themeMode.js'
export default {
mixins: [themeMixin],
// 然后可以直接使用以下属性和方法
created() {
console.log(this.isDarkMode) // 是否为暗色模式
console.log(this.currentTheme) // 'light' 或 'dark'
// 切换主题
this.toggleThemeMode()
}
}
详细的文档请参考 doc/dark-mode-guide.md
。