uniapp 设置页面示例:推送通知和声音提示
<p>///'<template>//n <view class=/'container/'>//n <view class=/'title/'>设置</view>//n <view class=/'option/'>//n <text>推送通知</text>//n <switch class=/'switch/' :checked=/'pushNotification/' @change=/'togglePushNotification/'></switch>//n </view>//n <view class=/'option/'>//n <text>声音提示</text>//n <switch class=/'switch/' :checked=/'soundNotification/' @change=/'toggleSoundNotification/'></switch>//n </view>//n <button class=/'button/' @tap=/'saveSettings/'>保存</button>//n </view>//n</template>//n//n<script>//n export default {//n data() {//n return {//n pushNotification: true,//n soundNotification: true//n };//n },//n methods: {//n togglePushNotification(value) {//n this.pushNotification = value;//n },//n toggleSoundNotification(value) {//n this.soundNotification = value;//n },//n saveSettings() {//n // 保存设置逻辑//n }//n }//n};//n</script>//n//n<style scoped>//n.container {//n display: flex;//n flex-direction: column;//n align-items: center;//n padding-top: 20px;//n}//n//n.title {//n font-size: 24px;//n margin-bottom: 20px;//n}//n//n.option {//n display: flex;//n justify-content: space-between;//n align-items: center;//n width: 90%;//n margin-bottom: 10px;//n}//n//n.switch {//n margin-left: 10px;//n}//n//n.button {//n width: 200px;//n height: 40px;//n background-color: #007aff;//n color: #fff;//n border-radius: 20px;//n margin-top: 20px;//n line-height: 40px;//n text-align: center;//n}//n</style>//n//n这个示例中的设置页面包含了两个开关选项,分别用来控制推送通知和声音提示的状态。用户可以通过点击开关来切换选项的状态,并且可以通过点击保存按钮来保存设置。你可以根据需求来自定义设置页面的样式和逻辑。/</p>
AI 优化版
原文地址:https://www.cveoy.top/t/topic/pz1y 著作权归作者所有。请勿转载和采集!