1. 程式人生 > 其它 >el-dialog修改彈框到頂部的高度margin-top

el-dialog修改彈框到頂部的高度margin-top

技術標籤:elementUIvuevue.js前端

el-dialog元件中

 style() {
        let style = {};
        if (!this.fullscreen) {
          style.marginTop = this.top;
          if (this.width) {
            style.width = this.width;
          }
        }
        return style;
      }

說明style.marginTop = this.top,所以可以直接新增top屬性就可以修改margin-top

  <el-dialog
                        title="測試標題"
                        :visible.sync="DialogVisible"
                        append-to-body
                        width="60%"
                        top="8vh"
                >