当前位置:   article > 正文

一个简单的小程序基本页面_一个基础的小程序页面

一个基础的小程序页面

页面数据渲染

  1. <template>
  2. <div>
  3. <div v-for="item in listData" class="details-list">
  4. <div class="detail-block">
  5. <div class="detail-item">
  6. <span>部门编号:</span>
  7. <span>{{ item.no }}</span>
  8. </div>
  9. <div class="detail-item">
  10. <span>部门名称:</span>
  11. <span>{{ item.name }}</span>
  12. </div>
  13. </div>
  14. <div class="detail-block">
  15. <div class="detail-item">
  16. <span>第一工位名称:</span>
  17. <span>{{ item.first }}</span>
  18. </div>
  19. <div class="detail-item">
  20. <span>第二工位名称:</span>
  21. <span>{{ item.second }}</span>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </template>

添加相关页面 

  1. <template>
  2. <div class="form-container">
  3. <div class="form-module">
  4. <label class="form-label required">名称</label>
  5. <div class="form-input-block">
  6. <input type="text" class="form-input" v-model="formParams.name" placeholder="请输入">
  7. </div>
  8. </div>
  9. <div class="form-module">
  10. <div class="form-button-block">
  11. <button class="form-button" @click="saveForm">提交</button>
  12. </div>
  13. </div>
  14. </div>
  15. </template>
  16. <script>
  17. export default {
  18. components: { //引入其它组件
  19. },
  20. data() { // 设置数据
  21. return {
  22. thatOptions: null,//当前页面的接收对象
  23. userInfo: [],//登录用户信息
  24. isSubmit: false, //是否提交过
  25. formParams: {}, //提交的数据对象
  26. }
  27. },
  28. onShow() { //页面显示或从后台跳回小程序时触发
  29. },
  30. onUnload: function () { //页面销毁
  31. this.thatPageClose();
  32. },
  33. onLoad(options) { //页面第一次加载
  34. let that = this;
  35. that.thatOptions = JSON.parse(options.options)
  36. console.log("初始化页面---")
  37. },
  38. mounted() { //vue 生命周期,初始化页面后对dom进行相关操作
  39. },
  40. methods: { //写方法的地方
  41. thatPageClose() { //页面销毁
  42. this.isSubmit = false; //是否提交过
  43. console.log("页面已销毁....")
  44. },
  45. saveForm() { //提交数据方法
  46. },
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. @import "static/common/common";
  52. @import './index.scss';
  53. </style>

相关css

  1. /******** form 表单样式开始 ***********/
  2. .form-container {
  3. padding: 10px;
  4. background-color: white;
  5. }
  6. .form-container .form-module {
  7. display: flex;
  8. margin-bottom: 10px;
  9. font-size: 12px;
  10. color: #000;
  11. }
  12. .form-container .form-module .form-label {
  13. width: 75px;
  14. line-height: 25px;
  15. }
  16. .form-container .form-module .required:after {
  17. content: '*';
  18. color: red;
  19. }
  20. .form-container .form-module .form-input-block {
  21. width: 100%;
  22. }
  23. .form-container .form-module .form-input-block .form-input {
  24. border-bottom: 1px solid #bfbfbf;
  25. }
  26. .form-container .form-module .form-button-block {
  27. width: 100%;
  28. text-align: center;
  29. display: block;
  30. margin: 20px 0;
  31. }
  32. .form-container .form-module .form-button-block .form-button {
  33. bottom: 0;
  34. width: 30%;
  35. text-align: center;
  36. background-color: #4C9BD9;
  37. color: #fff;
  38. line-height: 36px;
  39. font-size: 14px;
  40. }
  41. /******** form 表单样式结束 ,详情样式开始 ***********/
  42. .details-list {
  43. background-color: #F0F0F0;
  44. width: 100%;
  45. padding: 10px 0;
  46. font-size: 12px;
  47. color: #0A0A0A;
  48. }
  49. .item-right{
  50. padding-right: 10px;
  51. text-align: right;
  52. }
  53. .details-list .detail-block {
  54. background-color: white;
  55. width: 100%;
  56. padding: 10px;
  57. display: flex;
  58. }
  59. .details-list .detail-block .detail-item-row {
  60. width: 100%;
  61. padding-right: 10px;
  62. }
  63. .details-list .detail-block .detail-item {
  64. width: 50%;
  65. padding: 0 10px;
  66. }
  67. .details-list .detail-block .detail-item .item-title{
  68. font-weight: bold;
  69. font-size: 15px;
  70. }
  71. .details-list .detail-block .detail-item .item-button {
  72. background-color: #1E9FFF;
  73. padding: 2px 10px;
  74. color: white;
  75. font-size: 12px;
  76. }
  77. .page-bottom {
  78. width: 100%;
  79. position: fixed;
  80. display: flex;
  81. bottom: 0;
  82. }
  83. .page-bottom .page-bottom-button {
  84. background-color: #1E9FFF;
  85. width: 100%;
  86. font-size: 13px;
  87. color: white;
  88. }
  89. /******** 详情样式结束 ***********/

 

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
  • 相关标签
      

    闽ICP备14008679号