溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

dialog組件如何使用

發布時間:2022-03-24 17:47:35 來源:億速云 閱讀:173 作者:iii 欄目:web開發

這篇文章主要講解了“dialog組件如何使用”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“dialog組件如何使用”吧!

<template>

  <el-dialog

    :before-close="handleClose"

    :show="show"

    :show-close="false"

    :title="title"

    :top="dialogTop"

    :visible.sync="visible"

    :width="dialogWidth"

    :modal-append-to-body="false"

    center

    v-loading="loading"

  >

    <div class="capsule-btn">

      <fy-ripple-button :value="$_text['text.confirm']" @click="confirmOperation" size="medium"></fy-ripple-button>

      <fy-ripple-large-button :value="$_text['text.cancel']" @click="cancelOperation" size="medium"></fy-ripple-large-button>

    </div>

    <div :style="{height:slotHeight}" class="slot-wrap">

      <slot></slot>

    </div>

  </el-dialog>

</template>

<script>

export default {

  props: {

    // 點擊確定是否立馬關閉

    closeImmediately: {

      type: Boolean,

      default: true,

    },

    title: {

      type: String,

      default: '',

    },

    show: {

      type: Boolean,

      default: false,

    },

    dialogWidth: {

      type: String,

      default: '300px',

    },

    dialogTop: {

      type: String,

      default: '15vh',

    },

    slotHeight: {

      type: String,

      default: '',

    },

  },

  data() {

    return {

      visible: this.show,

      loading: false,

    }

  },

  methods: {

    confirmOperation() {

      if (this.closeImmediately === true) {

        this.$emit('update:show', false)

      }

      this.$emit('confim')

    },

    cancelOperation() {

      this.$emit('update:show', false)

      this.$emit('close')

    },

    // 關閉前的回調

    handleClose() {

      if (this.closeImmediately === true) {

        this.$emit('update:show', false)

      }

      this.$emit('close')

    },

  },

  watch: {

    show() {

      this.visible = this.show

    },

  },

}

</script>

<style lang="scss" scoped>

.slot-wrap {

  padding: 10px 0 30px 10px;

}

</style>

感謝各位的閱讀,以上就是“dialog組件如何使用”的內容了,經過本文的學習后,相信大家對dialog組件如何使用這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女