11<template >
2- <smart-widget-grid :layout =" layout" :row-height =" 48" :margin =" [15, 15]" @layout-updated =" handleLayoutUpdated" >
2+ <smart-widget-grid
3+ :layout =" layout"
4+ :row-height =" 48"
5+ :margin =" [15, 15]"
6+ :is-static =" isStatic"
7+ @layout-updated =" onLayoutUpdated"
8+ @move =" onMove"
9+ @container-resized =" onContainerResized" >
310 <smart-widget slot =" 0" simple >
411 <div class =" layout-center" >
512 <h3 >Simple Widget Without Header</h3 >
3845 </template >
3946 <p >Widget with Footer</p >
4047 </smart-widget >
41- <smart-widget slot =" 6" title =" Widget body content's height is fixed" fixed-height >
48+ <smart-widget slot =" 6" title =" 2017 Hotest Frontend Project"
49+ fullscreen
50+ refresh
51+ is-actived
52+ :loading =" loading"
53+ @before-fullscreen =" val => isStatic = val"
54+ @on-refresh =" handleRefresh" >
55+ <template v-slot =" {contentH } " >
56+ <ve-bar-chart :data =" barData" :height =" contentH" />
57+ </template >
58+ </smart-widget >
59+ <smart-widget slot =" 7" title =" Diffrent Platforms PV" fullscreen collapse >
60+ <template v-slot =" {contentH } " >
61+ <ve-donut-chart
62+ :data =" donutData"
63+ :settings =" donutSetting"
64+ :height =" contentH"
65+ />
66+ </template >
67+ </smart-widget >
68+ <smart-widget slot =" 8" title =" Widget body content's height is fixed" fixed-height >
4269 <el-table
4370 :data =" tableData"
4471 style =" width : 100% " >
5885 </el-table-column >
5986 </el-table >
6087 </smart-widget >
61- <smart-widget slot =" 7 " title =" Widget with custom toolbar" >
88+ <smart-widget slot =" 9 " title =" Widget with custom toolbar" >
6289 <template slot="toolbar">
6390 <div style =" margin : 0 12px ;" >
6491 <el-button type =" success" size =" mini" @click =" $router.push('/widget-only')" >Index</el-button >
6592 </div >
6693 </template >
67- <el-table
68- :data =" tableData"
69- style =" width : 100% " >
94+ <el-table style =" width : 100% " :data =" tableData" >
7095 <el-table-column
7196 prop =" date"
7297 label =" 日期"
83108 </el-table-column >
84109 </el-table >
85110 </smart-widget >
86- <smart-widget slot =" 8" title =" 2017 Hotest Frontend Project"
87- fullscreen
88- :loading =" loading"
89- refresh
90- @on-refresh =" handleRefresh" >
91- <ve-bar-chart :data =" barData" :height =" contentH" slot-scope =" {contentH}" />
92- </smart-widget >
93- <smart-widget slot =" 9" title =" Diffrent Platforms PV" fullscreen collapse >
94- <ve-donut-chart :data =" donutData" :settings =" donutSetting" :height =" contentH" slot-scope =" {contentH}" />
95- </smart-widget >
96111 </smart-widget-grid >
97112</template >
98113
@@ -101,34 +116,21 @@ export default {
101116 data () {
102117 return {
103118 loading: false ,
119+ isStatic: false ,
104120 layout: [
105- { x: 0 , y: 0 , w: 2 , h: 3 , i: ' 0' },
106- { x: 2 , y: 0 , w: 2 , h: 3 , i: ' 1' },
107- { x: 4 , y: 0 , w: 2 , h: 3 , i: ' 2' },
108- { x: 6 , y: 0 , w: 2 , h: 3 , i: ' 3' },
109- { x: 8 , y: 0 , w: 2 , h: 3 , i: ' 4' },
110- { x: 10 , y: 0 , w: 2 , h: 3 , i: ' 5' },
111- { x: 0 , y: 9 , w: 6 , h: 5 , i: ' 6' },
112- { x: 6 , y: 9 , w: 6 , h: 5 , i: ' 7' },
113- { x: 0 , y: 3 , w: 8 , h: 6 , i: ' 8' },
114- { x: 8 , y: 3 , w: 4 , h: 6 , i: ' 9' }
121+ { x: 0 , y: 0 , w: 4 , h: 3 , i: ' 0' },
122+ { x: 4 , y: 0 , w: 4 , h: 3 , i: ' 1' },
123+ { x: 8 , y: 0 , w: 4 , h: 3 , i: ' 2' },
124+ { x: 0 , y: 3 , w: 4 , h: 3 , i: ' 3' },
125+ { x: 4 , y: 3 , w: 4 , h: 3 , i: ' 4' },
126+ { x: 8 , y: 3 , w: 4 , h: 3 , i: ' 5' },
127+ { x: 0 , y: 6 , w: 8 , h: 6 , i: ' 6' },
128+ { x: 8 , y: 6 , w: 4 , h: 6 , i: ' 7' },
129+ { x: 0 , y: 12 , w: 6 , h: 5 , i: ' 8' },
130+ { x: 6 , y: 12 , w: 6 , h: 5 , i: ' 9' }
115131 ]
116132 }
117133 },
118- methods: {
119- handleRefresh () {
120- this .loading = true
121- setTimeout (() => {
122- this .loading = false
123- }, 2000 )
124- },
125- handleLayoutUpdated (newLayout ) {
126- console .log (JSON .stringify (newLayout))
127- },
128- handleMove (params ) {
129- console .log (params)
130- }
131- },
132134 created () {
133135 this .barData = {
134136 dimensions: {
@@ -159,38 +161,60 @@ export default {
159161 data: [40000 , 27800 , 22000 , 20200 , 13600 ]
160162 }]
161163 }
162- this .tableData = [{
163- date: ' 2016-05-03' ,
164- name: ' 王小虎' ,
165- address: ' 上海市普陀区金沙江路 1518 弄'
166- }, {
167- date: ' 2016-05-02' ,
168- name: ' 王小虎' ,
169- address: ' 上海市普陀区金沙江路 1518 弄'
170- }, {
171- date: ' 2016-05-04' ,
172- name: ' 王小虎' ,
173- address: ' 上海市普陀区金沙江路 1518 弄'
174- }, {
175- date: ' 2016-05-01' ,
176- name: ' 王小虎' ,
177- address: ' 上海市普陀区金沙江路 1518 弄'
178- }, {
179- date: ' 2016-05-08' ,
180- name: ' 王小虎' ,
181- address: ' 上海市普陀区金沙江路 1518 弄'
182- }, {
183- date: ' 2016-05-06' ,
184- name: ' 王小虎' ,
185- address: ' 上海市普陀区金沙江路 1518 弄'
186- }, {
187- date: ' 2016-05-07' ,
188- name: ' 王小虎' ,
189- address: ' 上海市普陀区金沙江路 1518 弄'
190- }]
164+ this .tableData = [
165+ {
166+ date: ' 2016-05-03' ,
167+ name: ' 王小虎' ,
168+ address: ' 上海市普陀区金沙江路 1518 弄'
169+ }, {
170+ date: ' 2016-05-02' ,
171+ name: ' 王小虎' ,
172+ address: ' 上海市普陀区金沙江路 1518 弄'
173+ }, {
174+ date: ' 2016-05-04' ,
175+ name: ' 王小虎' ,
176+ address: ' 上海市普陀区金沙江路 1518 弄'
177+ }, {
178+ date: ' 2016-05-01' ,
179+ name: ' 王小虎' ,
180+ address: ' 上海市普陀区金沙江路 1518 弄'
181+ }, {
182+ date: ' 2016-05-08' ,
183+ name: ' 王小虎' ,
184+ address: ' 上海市普陀区金沙江路 1518 弄'
185+ }, {
186+ date: ' 2016-05-06' ,
187+ name: ' 王小虎' ,
188+ address: ' 上海市普陀区金沙江路 1518 弄'
189+ }, {
190+ date: ' 2016-05-07' ,
191+ name: ' 王小虎' ,
192+ address: ' 上海市普陀区金沙江路 1518 弄'
193+ }
194+ ]
191195 this .donutSetting = {
192196 offsetY: ' 60%'
193197 }
198+ },
199+ methods: {
200+ handleRefresh () {
201+ this .loading = true
202+ setTimeout (() => {
203+ this .loading = false
204+ }, 2000 )
205+ },
206+ onLayoutUpdated (newLayout ) {
207+ console .log (JSON .stringify (newLayout))
208+ },
209+ onMove (params ) {
210+ console .log (params)
211+ },
212+ onResize (params ) {
213+ console .log (params)
214+ },
215+ onContainerResized (params ) {
216+ console .log (params)
217+ }
194218 }
195219}
196220 </script >
@@ -202,6 +226,9 @@ export default {
202226 border-top : 1px solid #ebeef1 ;
203227}
204228.layout-center {
205- text-align : center ;
229+ display : flex ;
230+ justify-content : center ;
231+ align-items : center ;
232+ height : 100% ;
206233}
207234 </style >
0 commit comments