0.0.1 • Published 4 years ago

vue-action-confirm v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

action-confirm

Element a confirmation component that's based on element-ui.

Install

npm install vue-action-confirm -S

Quick Start

import Vue from 'vue'
import ActionConfirm from 'vue-action-confirm'
# Vue.component('vue-action-confirm', ActionConfirm) # 可以指定组件名称
Vue.use(ActionConfirm) # 组件名称 `vue-action-confirm`

For more information, please refer to Progress in our documentation.

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run demo:dev

# build for demo with minification
npm run demo:build

# build for gh-pages with minification
npm run demo:prepublish

# build for production with minification
npm run build

# generate gh-pages
npm run deploy

LICENSE

MIT

截图

截图

基本用法

<template>
  <el-table
    :data="tableData"
    style="width: 701px">
    <el-table-column prop='id' label='次数' data-align='right' fixed width='68'></el-table-column>
    <el-table-column
      prop="date"
      label="更新日期"
      width="165">
    </el-table-column>
    <el-table-column
      prop="name"
      label="姓名"
      width="110"
    >
    </el-table-column>
    <el-table-column
      prop="address"
      width='250'
      label="地址">
    </el-table-column>
    <el-table-column
      label="操作"
      fixed="right"
      width="108">
      <template slot-scope="scope">
        <vue-action-confirm
          title="确定删除吗?"
          @confirm="onConfirm(scope.row)"
        >
          <el-button type="text" class="delete-btn" slot="reference">删除</el-button>
        </vue-action-confirm>
      </template>
    </el-table-column>
  </el-table>
</template>
<script>
import VueActionConfirm from 'vue-action-confirm';

export default {
  componenets: {
    VueActionConfirm
  },

  data() {
    return {
      tableData: [{
        id: 123,
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄',
        tags: ["标签1", "标签很长很长很长很长很长很长", "标签很长很长很长很长很长很长", "标签"],
      }, {
        id: 223,
        date: '2016-05-04',
        name: '小虎',
        address: '上海市普陀区金沙江路 1517 弄',
        tags: ["标签1", "标签很长很长很长很长很长很长", "标签很长很长很长很长很长很长", "标签"],
      }, {
        id: 32,
        date: '2016-05-01',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1519 弄',
        tags: ["标签1", "标签很长很长很长很长很长很长", "标签很长很长很长很长很长很长", "标签"],
      }, {
        id: 4,
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄',
        tags: ["标签1", "标签很长很长很长很长很长很长", "标签很长很长很长很长很长很长", "标签"],
      }]
    }
  },

  methods: {
    onConfirm(item) {
      console.log('confirm', item);
    }
  }
}
</script>

ActionConfirm props

参数说明类型可选值默认值
title标题String--
popper-refPopover引用名称Stringpopover
popper-propsPopover参数Object参考popover组件{ placement: 'top' }
disabledPopover 是否可用Boolean-false
show-confirm是否显示确认按钮Boolean-true
show-cancel是否显示取消按钮Boolean-true
btn-ok-class为确认按钮添加类名String-action-confirm-ok
btn-cancel-class为取消按钮添加类名String-action-cancel-ok
btn-ok-label确认按钮文案String-确认
btn-cancel-label取消按钮文案String-取消
btn-ok-disabled是否置灰确认按钮String-false
btn-cancel-disabled是否置灰取消按钮String-false
btn-reference-class为默认触发按钮添加类名String-reference-btn
btn-reference-label默认触发按钮文案String-删除
loading加载状态Boolean-false

ActionConfirm events

事件名称说明回调参数
show显示时触发-
hide隐藏时触发-
visible-change出现/隐藏时触发出现则为true,隐藏则为false
confirm确认时触发-
cancel取消时触发-

ActionConfirm slot

名称说明
-弹出框的内容
footer弹出框的尾部内容,默认显示确认和取消按钮
reference触发弹出框显示的 HTML 元素
0.0.1

4 years ago