index.vue 914 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <view class="u-demo">
  3. <view class="u-demo-wrap">
  4. <view class="u-demo-title">演示效果</view>
  5. <view class="u-demo-area">
  6. <view class="u-no-demo-here">
  7. 源数组为:[1, 2, 3, 4, 5]
  8. </view>
  9. <view class="u-demo-result-line">
  10. {{`[${result.join(', ')}]`}}
  11. </view>
  12. </view>
  13. </view>
  14. <view class="u-config-wrap">
  15. <view class="u-config-title u-border-bottom">
  16. 参数配置
  17. </view>
  18. <view class="u-config-item">
  19. <view class="u-item-title">操作</view>
  20. <u-button @click="getResult">执行</u-button>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. orginArray: [1, 2, 3, 4, 5],
  30. result: [],
  31. }
  32. },
  33. onLoad() {
  34. this.getResult();
  35. },
  36. methods: {
  37. getResult() {
  38. this.result = this.$u.randomArray(this.orginArray);
  39. }
  40. }
  41. }
  42. </script>
  43. <style lang="scss" scoped>
  44. .u-demo {}
  45. </style>