dragDialog.vue 1.9KB

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