index.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <view class="item-list-simple-container">
  3. <template v-for="(item, index) in ds">
  4. <view class="list-item" :key="index" @click="onItemClick(item)">
  5. <view class="item-icon"
  6. :style="{
  7. background: `url(${getImageUrl(ICON_CFG.theme_icon)}) no-repeat `,
  8. backgroundSize: '100%',
  9. }"
  10. ></view>
  11. <view class="list-item-right">
  12. <view class="item-title">{{ item.title }}</view>
  13. </view>
  14. </view>
  15. </template>
  16. </view>
  17. </template>
  18. <script>
  19. import { ICON_CFG } from '@/common/EnumConst';
  20. import { getImageUrl } from '@/util';
  21. export default {
  22. name: 'item-list-simple',
  23. computed: {
  24. ICON_CFG() {
  25. return ICON_CFG;
  26. },
  27. },
  28. props: {
  29. ds: {
  30. type: Array,
  31. default: () => [],
  32. },
  33. onItemClick: {
  34. type: Function,
  35. default: () => {},
  36. },
  37. },
  38. data() {
  39. return {};
  40. },
  41. created() {
  42. this.children = [];
  43. },
  44. onLoad() {
  45. },
  46. methods: { getImageUrl },
  47. };
  48. </script>
  49. <style lang="scss" src="./index.scss" />