index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <demo-section>
  3. <demo-block :title="$t('basicUsage')">
  4. <van-cell-group>
  5. <van-cell
  6. :title="$t('cell')"
  7. :value="$t('content')"
  8. />
  9. <van-cell
  10. :title="$t('cell')"
  11. :value="$t('content')"
  12. :label="$t('desc')"
  13. />
  14. </van-cell-group>
  15. </demo-block>
  16. <demo-block :title="$t('largeSize')">
  17. <van-cell
  18. :title="$t('cell')"
  19. :value="$t('content')"
  20. size="large"
  21. />
  22. <van-cell
  23. :title="$t('cell')"
  24. :value="$t('content')"
  25. size="large"
  26. :label="$t('desc')"
  27. />
  28. </demo-block>
  29. <demo-block :title="$t('showIcon')">
  30. <van-cell
  31. :title="$t('cell')"
  32. :value="$t('content')"
  33. icon="location-o"
  34. />
  35. </demo-block>
  36. <demo-block :title="$t('valueOnly')">
  37. <van-cell :value="$t('content')" />
  38. </demo-block>
  39. <demo-block :title="$t('showArrow')">
  40. <van-cell
  41. :title="$t('cell')"
  42. is-link
  43. />
  44. <van-cell
  45. :title="$t('cell')"
  46. is-link
  47. :value="$t('content')"
  48. />
  49. <van-cell
  50. :title="$t('cell')"
  51. is-link
  52. arrow-direction="down"
  53. :value="$t('content')"
  54. />
  55. </demo-block>
  56. <demo-block :title="$t('router')">
  57. <van-cell
  58. :title="$t('cell')"
  59. is-link
  60. url="//youzan.github.io/vant/mobile.html"
  61. />
  62. <van-cell
  63. :title="$t('cell')"
  64. is-link
  65. to="index"
  66. />
  67. </demo-block>
  68. <demo-block :title="$t('groupTitle')">
  69. <van-cell-group :title="`${$t('group')} 1`">
  70. <van-cell
  71. :title="$t('cell')"
  72. :value="$t('content')"
  73. />
  74. </van-cell-group>
  75. <van-cell-group :title="`${$t('group')} 2`">
  76. <van-cell
  77. :title="$t('cell')"
  78. :value="$t('content')"
  79. />
  80. </van-cell-group>
  81. </demo-block>
  82. <demo-block :title="$t('advancedUsage')">
  83. <van-cell
  84. :value="$t('content')"
  85. icon="shop-o"
  86. is-link
  87. >
  88. <template slot="title">
  89. <span class="custom-text">{{ $t('cell') }}</span>
  90. <van-tag type="danger">{{ $t('tag') }}</van-tag>
  91. </template>
  92. </van-cell>
  93. <van-cell
  94. :title="$t('cell')"
  95. icon="location-o"
  96. is-link
  97. />
  98. <van-cell :title="$t('cell')">
  99. <van-icon
  100. slot="right-icon"
  101. name="search"
  102. class="custom-icon"
  103. />
  104. </van-cell>
  105. </demo-block>
  106. </demo-section>
  107. </template>
  108. <script>
  109. export default {
  110. i18n: {
  111. 'zh-CN': {
  112. cell: '单元格',
  113. valueOnly: '只设置 value',
  114. showIcon: '展示图标',
  115. showArrow: '展示箭头',
  116. largeSize: '单元格大小',
  117. group: '分组',
  118. groupTitle: '分组标题',
  119. router: '页面跳转'
  120. },
  121. 'en-US': {
  122. cell: 'Cell title',
  123. valueOnly: 'Value only',
  124. showIcon: 'Left Icon',
  125. showArrow: 'Link',
  126. largeSize: 'Size',
  127. group: 'Group',
  128. groupTitle: 'Group Title',
  129. router: 'Router'
  130. }
  131. }
  132. };
  133. </script>
  134. <style lang="less">
  135. .demo-cell {
  136. .custom-text {
  137. margin-right: 5px;
  138. vertical-align: middle;
  139. }
  140. .custom-icon {
  141. line-height: 24px;
  142. }
  143. }
  144. </style>