开始

image.png

image.png

image.png
修改页面标题
image.png
从home页跳转过去
image.png

  1. onNavigationBarButtonTap(e) {
  2. if (e.index == 0) {
  3. console.log('跳转设置页');
  4. uni.navigateTo({
  5. url:'../user-set/user-set'
  6. })
  7. }
  8. },

封装的组件。判断icon图标是否存在才去显示。
image.png

  1. <view class="u-f-ac">
  2. <view v-if="item.icon"
  3. class="icon iconfont"
  4. :class="['icon-'+item.icon]"></view>
  5. {{item.name}}
  6. </view>

image.png

  1. import homeListItem from '@/components/home/home-list-item.vue';

最外层加边距
image.png

image.png

image.png

  1. <view class="body">
  2. <block v-for="(item,index) in list" :key="index">
  3. <home-list-item :item="item" :index="index"></home-list-item>
  4. </block>
  5. </view>

image.png

  1. list: [{
  2. icon: "",
  3. name: "账号与安全"
  4. },
  5. {
  6. icon: "",
  7. name: "绑定邮箱"
  8. },
  9. {
  10. icon: "",
  11. name: "资料编辑"
  12. },
  13. {
  14. icon: "",
  15. name: "小纸条"
  16. },
  17. {
  18. icon: "",
  19. name: "清除缓存"
  20. },
  21. {
  22. icon: "",
  23. name: "意见反馈"
  24. },
  25. {
  26. icon: "",
  27. name: "关于糗百"
  28. },
  29. ]

按钮
image.png

  1. <button class="user-set-btn" type="primary">退出登陆</button>

是00%的宽度,上下20的外边距。
image.png
取按钮的颜色
image.png
背景色和字体的颜色
image.png

  1. .user-set-btn{
  2. width: 100%;
  3. margin: 20upx 0;
  4. background: #FFE933;
  5. color: #333333;
  6. }

image.png

image.png

image.png
边框设置为0
image.png

  1. .user-set-btn{
  2. width: 100%;
  3. margin: 20upx 0;
  4. background: #FFE933!important;
  5. border: 0!important;
  6. color: #333333;
  7. }

image.png

  1. .user-set-btn{
  2. width: 100%;
  3. margin: 20upx 0;
  4. background: #FFE933!important;
  5. border: 0!important;
  6. color: #333333!important;
  7. }

image.png

本节代码

user-set.vue页面

  1. <template>
  2. <view class="body">
  3. <block v-for="(item,index) in list" :key="index">
  4. <home-list-item :item="item" :index="index"></home-list-item>
  5. </block>
  6. <button class="user-set-btn" type="primary">退出登陆</button>
  7. </view>
  8. </template>
  9. <script>
  10. import homeListItem from '@/components/home/home-list-item.vue';
  11. export default {
  12. components: {
  13. homeListItem
  14. },
  15. data() {
  16. return {
  17. list: [{
  18. icon: "",
  19. name: "账号与安全"
  20. },
  21. {
  22. icon: "",
  23. name: "绑定邮箱"
  24. },
  25. {
  26. icon: "",
  27. name: "资料编辑"
  28. },
  29. {
  30. icon: "",
  31. name: "小纸条"
  32. },
  33. {
  34. icon: "",
  35. name: "清除缓存"
  36. },
  37. {
  38. icon: "",
  39. name: "意见反馈"
  40. },
  41. {
  42. icon: "",
  43. name: "关于糗百"
  44. },
  45. ]
  46. }
  47. },
  48. methods: {
  49. }
  50. }
  51. </script>
  52. <style>
  53. .body {
  54. padding: 0 20upx;
  55. }
  56. .user-set-btn{
  57. width: 100%;
  58. margin: 20upx 0;
  59. background: #FFE933!important;
  60. border: 0!important;
  61. color: #333333!important;
  62. }
  63. </style>

结束