index.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. <view class="u-no-demo-here">请点击弹出弹窗查看效果</view>
  8. <u-modal ref="uModal" v-model="show" :show-cancel-button="true"
  9. :show-title="showTitle" :async-close="asyncClose"
  10. @confirm="confirm" :content="content"
  11. >
  12. <!-- #ifndef MP-WEIXIN || MP-TOUTIAO -->
  13. <view class="warp" style="margin: 30rpx;" v-if="contentSlot">
  14. <image class="logo" src="https://uviewui.com/common/logo.png" style="width: 220rpx;" mode="widthFix"></image>
  15. </view>
  16. <!-- #endif -->
  17. </u-modal>
  18. </view>
  19. </view>
  20. <view class="u-config-wrap">
  21. <view class="u-config-title u-border-bottom">参数配置</view>
  22. <view class="u-config-item">
  23. <view class="u-item-title">状态</view>
  24. <u-subsection :current="current" :list="['显示', '隐藏']" @change="showChange"></u-subsection>
  25. </view>
  26. <view class="u-config-item">
  27. <view class="u-item-title">是否显示标题</view>
  28. <u-subsection current="0" :list="['是', '否']" @change="titleChange"></u-subsection>
  29. </view>
  30. <!-- #ifndef MP-WEIXIN -->
  31. <view class="u-config-item">
  32. <view class="u-item-title">自定义内容</view>
  33. <u-subsection current="1" :list="['是', '否']" @change="contentChange"></u-subsection>
  34. </view>
  35. <!-- #endif -->
  36. <view class="u-config-item">
  37. <view class="u-item-title">异步关闭</view>
  38. <u-subsection current="1" :list="['是', '否']" @change="asyncChange"></u-subsection>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  47. show: false,
  48. zoom: false,
  49. content: '慈母手中线,游子身上衣',
  50. contentSlot: false,
  51. showTitle: true,
  52. asyncClose: false,
  53. };
  54. },
  55. computed: {
  56. current() {
  57. return this.show ? 0 : 1;
  58. }
  59. },
  60. methods: {
  61. showChange(index) {
  62. this.show = !index;
  63. },
  64. titleChange(index) {
  65. this.showTitle = !index;
  66. this.show = true;
  67. },
  68. contentChange(index) {
  69. this.contentSlot = !index;
  70. this.show = true;
  71. },
  72. asyncChange(index) {
  73. this.show = true;
  74. this.asyncClose = !index;
  75. },
  76. confirm() {
  77. setTimeout(() => {
  78. this.show = false;
  79. }, 2000)
  80. }
  81. }
  82. };
  83. </script>
  84. <style scoped lang="scss">
  85. .logo {
  86. height: auto;
  87. will-change: transform;
  88. }
  89. </style>