UniApp 小说设置页面:美观设计、退出登录按钮等
<p>"<template>\n <view class="container">\n <view class="setting-item">\n <text class="item-label">账号</text>\n <text class="item-value">{{ account }}</text>\n </view>\n <view class="setting-item">\n <text class="item-label">密码</text>\n <text class="item-value">{{ password }}</text>\n </view>\n <view class="setting-item">\n <text class="item-label">邮箱</text>\n <text class="item-value">{{ email }}</text>\n </view>\n <button class="logout-button" @click="logout">退出登录</button>\n </view>\n</template>\n\n<script>\n export default {\n data() {\n return {\n account: 'example',\n password: '******',\n email: 'example@example.com'\n }\n },\n methods: {\n logout() {\n // 在这里执行退出登录的逻辑\n // 可以清除本地存储的登录状态等操作\n uni.reLaunch({\n url: '/pages/login' // 跳转到登录页\n })\n }\n }\n}\n</script>\n\n<style>\n.container {\n padding: 20px;\n}\n\n.setting-item {\n display: flex;\n justify-content: space-between;\n margin-bottom: 10px;\n}\n\n.item-label {\n font-size: 16px;\n color: #333;\n}\n\n.item-value {\n font-size: 16px;\n color: #999;\n}\n\n.logout-button {\n width: 100%;\n height: 40px;\n line-height: 40px;\n text-align: center;\n background-color: #f00;\n color: #fff;\n font-size: 16px;\n border-radius: 5px;\n}\n</style>\n\n在这个示例中,我们使用了一个容器视图(container)来包含设置页面的内容。每个设置项都使用设置项视图(setting-item)进行布局,包括标签(item-label)和值(item-value)。最后,我们添加了一个退出登录按钮(logout-button),通过调用logout方法来执行退出登录的逻辑。\n\n当点击退出登录按钮时,我们使用uni.reLaunch方法跳转到登录页,以便重新登录。你可以根据自己的需求进行修改和扩展。</p>
AI 优化版
原文地址:https://www.cveoy.top/t/topic/pzZQ 著作权归作者所有。请勿转载和采集!