index.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. <u-toast ref="uToast"></u-toast>
  7. <u-swiper @change="change" :height="250" :list="list" :title="title" :effect3d="effect3d"
  8. :indicator-pos="indicatorPos" :mode="mode" :interval="3000" @click="click"></u-swiper>
  9. </view>
  10. </view>
  11. <view class="u-config-wrap">
  12. <view class="u-config-title u-border-bottom">
  13. 参数配置
  14. </view>
  15. <view class="u-config-item">
  16. <view class="u-item-title">指示器模式</view>
  17. <u-subsection :list="['round', 'rect', 'number', 'none']" @change="modeChange"></u-subsection>
  18. </view>
  19. <view class="u-config-item">
  20. <view class="u-item-title">标题</view>
  21. <u-subsection current="1" :list="['显示', '隐藏']" @change="titleChange"></u-subsection>
  22. </view>
  23. <view class="u-config-item">
  24. <view class="u-item-title">指示器位置</view>
  25. <u-subsection current="3" :list="['上左', '上右', '下左', '下中', '下右']" @change="indicatorPosChange"></u-subsection>
  26. </view>
  27. <view class="u-config-item">
  28. <view class="u-item-title">3D效果</view>
  29. <u-subsection current="1" :list="['开启', '关闭']" @change="effect3dChange"></u-subsection>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. list: [{
  39. image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
  40. title: '昨夜星辰昨夜风,画楼西畔桂堂东'
  41. },
  42. {
  43. image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
  44. title: '身无彩凤双飞翼,心有灵犀一点通'
  45. },
  46. {
  47. image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
  48. title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
  49. }
  50. ],
  51. title: false,
  52. mode: 'round',
  53. indicatorPos: 'bottomCenter',
  54. effect3d: false,
  55. }
  56. },
  57. methods: {
  58. titleChange(index) {
  59. this.title = index == 0 ? true : false;
  60. },
  61. modeChange(index) {
  62. this.mode = index == 0 ? 'round' : index == 1 ? 'rect' : index == 2 ? 'number' : 'none';
  63. },
  64. indicatorPosChange(index) {
  65. this.indicatorPos = index == 0 ? 'topLeft' : index == 1 ? 'topRight' : index == 2 ? 'bottomLeft' : index == 3 ? 'bottomCenter' : 'bottomRight';
  66. },
  67. effect3dChange(index) {
  68. this.effect3d = index == 0 ? true : false;
  69. },
  70. click(index) {
  71. this.$refs.uToast.show({
  72. title: `点击了第${index + 1}张图片`,
  73. type: 'success'
  74. })
  75. },
  76. change(index) {
  77. // console.log(index);
  78. }
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .item {
  84. margin: 30rpx 0;
  85. }
  86. </style>