index.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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-button @click="showAction">唤起ActionSheet</u-button>
  8. <u-action-sheet :cancel-btn="cancel" :mask-close-able="maskClick" :tips="tips"
  9. @click="click" :list="list" v-model="show" :safe-area-inset-bottom="true"></u-action-sheet>
  10. </view>
  11. </view>
  12. <view class="u-config-wrap">
  13. <view class="u-config-title u-border-bottom">
  14. 参数配置
  15. </view>
  16. <view class="u-config-item">
  17. <view class="u-item-title">取消按钮</view>
  18. <u-subsection :list="['是', '否']" @change="cancelChange"></u-subsection>
  19. </view>
  20. <view class="u-config-item">
  21. <view class="u-item-title">点击遮罩关闭</view>
  22. <u-subsection :list="['是', '否']" @change="maskClickChange"></u-subsection>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. list: [{
  32. text: '最是人间留不住',
  33. }, {
  34. text: '朱颜辞镜花辞树',
  35. disabled: true
  36. }, {
  37. text: '正是江南好风景',
  38. subText: '春江水暖鸭先知'
  39. }, {
  40. text: '落花时节又逢君'
  41. }],
  42. tips: {
  43. text: ''
  44. },
  45. show: false,
  46. cancel: true,
  47. maskClick: true
  48. }
  49. },
  50. methods: {
  51. showAction() {
  52. this.show = true;
  53. },
  54. click(index) {
  55. this.$refs.uToast.show({
  56. type: 'success',
  57. title: '点击了第' + (index + 1) + '项'
  58. })
  59. },
  60. tipsChange(index) {
  61. if(index == 0) this.show = true;
  62. this.tips.text = index == 0 ? '请谨慎执行您的操作' : ''
  63. },
  64. cancelChange(index) {
  65. this.show = true;
  66. this.cancel = index == 0 ? true : false
  67. },
  68. maskClickChange(index) {
  69. if(index == 1) this.cancel = true;
  70. this.show = true;
  71. this.maskClick = index == 0 ? true : false
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .wrap {
  78. padding: 24rpx;
  79. }
  80. </style>