projectList.vue 980 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <view class="project-index">
  3. <view class="project-item" v-for="(item,index) in list" :key="item.id">
  4. <uni-data-checkbox class="selet-box" v-model="project" :localdata="[item]" :map="map"></uni-data-checkbox>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import {
  10. getProjectList
  11. } from '@/request/api/project'
  12. export default {
  13. data() {
  14. return {
  15. list: [],
  16. project: '',
  17. map: {
  18. text: 'name',
  19. value: 'id'
  20. }
  21. }
  22. },
  23. onLoad() {
  24. this.init();
  25. },
  26. methods: {
  27. init() {
  28. getProjectList().then(res => {
  29. if (res.code == 200) {
  30. this.list = res.data;
  31. }
  32. })
  33. }
  34. }
  35. }
  36. </script>
  37. <style lang="scss">
  38. .project-index {
  39. padding: 20rpx 30rpx;
  40. .project-item {
  41. background: $uni-white;
  42. padding: 10rpx 20rpx;
  43. margin-bottom: 20rpx;
  44. border-radius: 12rpx;
  45. .selet-box {
  46. width: 100%;
  47. }
  48. .checklist-box {
  49. flex: 1;
  50. }
  51. }
  52. }
  53. </style>