零售收银终端CheckoutPad_ox_as
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.9 KiB

1 year ago
  1. <template>
  2. <view class="uni-container">
  3. <view class="uni-hello-text">
  4. <text class="hello-text">uni原生插件示例</text>
  5. </view>
  6. <view class="uni-panel" v-for="(item, index) in list" :key="item.id">
  7. <view class="uni-panel-h" :class="item.open ? 'uni-panel-h-on' : ''" @click="triggerCollapse(index)">
  8. <text class="uni-panel-text">{{item.name}}</text>
  9. <text class="uni-panel-icon uni-icon" :class="item.open ? 'uni-panel-icon-on' : ''">{{item.pages ? '&#xe581;' : '&#xe470;'}}</text>
  10. </view>
  11. <view class="uni-panel-c" v-if="item.open">
  12. <view class="uni-navigate-item" v-for="(item2,key) in item.pages" :key="key" @click="goDetailPage(item2.url)">
  13. <text class="uni-navigate-text">{{item2.name ? item2.name : item2}}</text>
  14. <text class="uni-navigate-icon uni-icon">&#xe470;</text>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. list: [{
  25. id: 'ext-module',
  26. name: '扩展 module',
  27. open: false,
  28. url: '/pages/sample/ext-module'
  29. },
  30. {
  31. id: 'ext-component',
  32. name: '扩展 component',
  33. open: false,
  34. url: '/pages/sample/ext-component'
  35. },
  36. {
  37. id:'richAlert',
  38. name:'插件示例RichAlert',
  39. open:false,
  40. url:'/pages/sample/richAlert'
  41. }],
  42. navigateFlag: false
  43. }
  44. },
  45. onLoad() {},
  46. methods: {
  47. triggerCollapse(e) {
  48. if (!this.list[e].pages) {
  49. this.goDetailPage(this.list[e].url);
  50. return;
  51. }
  52. for (var i = 0; i < this.list.length; ++i) {
  53. if (e === i) {
  54. this.list[i].open = !this.list[e].open;
  55. } else {
  56. this.list[i].open = false;
  57. }
  58. }
  59. },
  60. goDetailPage(e) {
  61. if (this.navigateFlag) {
  62. return;
  63. }
  64. this.navigateFlag = true;
  65. uni.navigateTo({
  66. url: e
  67. });
  68. setTimeout(() => {
  69. this.navigateFlag = false;
  70. }, 200)
  71. return false;
  72. }
  73. }
  74. }
  75. </script>
  76. <style>
  77. </style>