drag-dialog.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <div class="components-container">
  3. <el-button type="primary" @click="dialogTableVisible = true">
  4. open a Drag Dialog
  5. </el-button>
  6. <el-dialog v-el-drag-dialog :visible.sync="dialogTableVisible" title="Shipping address" @dragDialog="handleDrag">
  7. <el-select ref="select" v-model="value" placeholder="请选择">
  8. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  9. </el-select>
  10. <el-table :data="gridData">
  11. <el-table-column property="date" label="Date" width="150" />
  12. <el-table-column property="name" label="Name" width="200" />
  13. <el-table-column property="address" label="Address" />
  14. </el-table>
  15. </el-dialog>
  16. </div>
  17. </template>
  18. <script>
  19. import elDragDialog from '@/directive/el-drag-dialog' // base on element-ui
  20. export default {
  21. name: 'DragDialogDemo',
  22. directives: { elDragDialog },
  23. data() {
  24. return {
  25. dialogTableVisible: false,
  26. options: [
  27. { value: '选项1', label: '黄金糕' },
  28. { value: '选项2', label: '双皮奶' },
  29. { value: '选项3', label: '蚵仔煎' },
  30. { value: '选项4', label: '龙须面' }
  31. ],
  32. value: '',
  33. gridData: [{
  34. date: '2016-05-02',
  35. name: 'John Smith',
  36. address: 'No.1518, Jinshajiang Road, Putuo District'
  37. }, {
  38. date: '2016-05-04',
  39. name: 'John Smith',
  40. address: 'No.1518, Jinshajiang Road, Putuo District'
  41. }, {
  42. date: '2016-05-01',
  43. name: 'John Smith',
  44. address: 'No.1518, Jinshajiang Road, Putuo District'
  45. }, {
  46. date: '2016-05-03',
  47. name: 'John Smith',
  48. address: 'No.1518, Jinshajiang Road, Putuo District'
  49. }]
  50. }
  51. },
  52. methods: {
  53. // v-el-drag-dialog onDrag callback function
  54. handleDrag() {
  55. this.$refs.select.blur()
  56. }
  57. }
  58. }
  59. </script>