11<template >
22 <div >
33 <div class =" site-demo-container" >
4+ <div class =" operation" >
5+ {{ currentLocal["columnFixed"] }}
6+ <el-switch
7+ v-model =" columnFixed"
8+ active-color =" #1890ff"
9+ inactive-color =" rgba(0,0,0,.25)"
10+ >
11+ </el-switch >
12+ </div >
13+
414 <ve-table
515 fixed-header
616 border-y
2030<script >
2131/* import Footer from "@/comp/layout/footer.vue"; */
2232import Mock from " mockjs" ;
33+ import locale from " ../comp/locale" ;
34+ import I18nMixins from " ../comp/mixins/i18n-mixins" ;
2335export default {
2436 components: {
2537 /* Footer */
2638 },
39+ mixins: [I18nMixins],
2740 data () {
2841 return {
42+ columnFixed: true ,
43+
44+ // ---------------table options---------------
2945 cellStyleOption: {
3046 bodyCellClass : ({ row, column, rowIndex }) => {
3147 if (column .field === " proficiency" ) {
@@ -37,17 +53,27 @@ export default {
3753 // 是否开启
3854 enable: true
3955 },
40- columns: [
56+ tableData: []
57+ };
58+ },
59+ computed: {
60+ // current local
61+ currentLocal () {
62+ return locale[this .currentDocLang ][" completeDemo" ];
63+ },
64+
65+ columns () {
66+ let columns = [
4167 {
4268 field: " rowIndex" ,
4369 key: " a" ,
4470 title: " #" ,
4571 width: 50 ,
46- fixed: " left"
72+ fixed: this . columnFixed ? " left" : " "
4773 },
4874 {
4975 title: " Basic Info" ,
50- fixed: " left" ,
76+ fixed: this . columnFixed ? " left" : " " ,
5177 children: [
5278 {
5379 field: " name" ,
@@ -73,7 +99,7 @@ export default {
7399 return (
74100 < i
75101 style= " font-size:20px;color:#666;"
76- class = {" iconfont " + iconName}
102+ class = {" demo-sex iconfont " + iconName}
77103 / >
78104 );
79105 }
@@ -189,7 +215,7 @@ export default {
189215 key: " h" ,
190216 title: " Status" ,
191217 width: 55 ,
192- fixed: " right" ,
218+ fixed: this . columnFixed ? " right" : " " ,
193219 align: " left" ,
194220 renderBodyCell : ({ row, column, rowIndex }, h ) => {
195221 const cellData = row[column .field ];
@@ -218,14 +244,15 @@ export default {
218244 );
219245 }
220246 }
221- ],
222- tableData: []
223- };
247+ ];
248+
249+ return columns;
250+ }
224251 },
225252 methods: {
226- getRandom ( min , max ) {
227- return Math . floor ( Math . random () * (max - min) + min);
228- },
253+ // column fixed change
254+ columnFixedChange () {},
255+
229256 initData () {
230257 const PROFESSIONS = [
231258 " Project Manager" ,
@@ -265,6 +292,21 @@ export default {
265292 margin-top : 62px ;
266293 padding : 10px ;
267294
295+ .operation {
296+ margin : 30px 0 ;
297+ }
298+
299+ // demo sex field
300+ .demo-sex {
301+ & .icon-male {
302+ color : #91d5ff !important ;
303+ }
304+
305+ & .icon-female {
306+ color : #ffadd2 !important ;
307+ }
308+ }
309+
268310 // proficiency filed custom cell style
269311 .table-body-cell-proficiency {
270312 padding : 0 !important ;
0 commit comments