<template>
  <demo-section>
    <demo-block :title="'插件'">
      <drip-button @click="showDialog1" type="orange">消息提示</drip-button>
      <drip-button @click="showDialog2">关闭弹框做些处理</drip-button>
      <drip-button @click="showDialog3" type="blue">弹框加上标题</drip-button>
    </demo-block>

    <demo-block :title="'组件引用'">
      <drip-button
        @click="visible = true"
        type="orange">
        组件引用
      </drip-button>
      <drip-dialog
        :visible="visible"
        @onHide="visible = false">
        <div>
          <p>组件引用方式</p>
        </div>
      </drip-dialog>
    </demo-block>

    <demo-block :title="'自定义内容--活动弹框'">
      <drip-button
        @click="visible2 = true"
        type="orange">
        活动弹框
      </drip-button>
      <drip-dialog
        :visible="visible2"
        :isSlot="true"
        :showClose="false">
        <div slot="free" class="content">
          <p>活动弹框</p>
          <drip-button
            @click="visible2 = false"
            type="orange">
            关闭弹框
          </drip-button>
        </div>
      </drip-dialog>
    </demo-block>
  </demo-section>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      visible2: false
    }
  },
  methods: {
    showDialog1 () {
      this.$dialog.show({
        content: '这个是消息提示'
      })
    },
    showDialog2 () {
      this.$dialog.show({
        content: '这个是消息提示',
        onHide: () => {
          console.log(3333)
          this.$dialog.hide()
        }
      })
    },
    showDialog3 () {
      this.$dialog.show({
        title: '这是标题',
        content: '这个内容<br>支持换行'
      })
    }
  }
}
</script>

<style lang="postcss">
.demo-dialog {
  .drip-button {
    margin-right: 10px;
  }

  .van-doc-demo-block {
    padding: 0 15px;
  }

  &-row {
    margin-bottom: 10px;
  }
  .content {
    width: 700px;
    height: 300px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 24px;
  }
}
</style>
