gui-column.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view
  3. :class="classesRuntime"
  4. :style="styleRuntime">
  5. <slot></slot>
  6. </view>
  7. </template>
  8. <script>
  9. export default{
  10. name : "gui-column",
  11. props : {
  12. mainAxisAlignment : {type:String, default:'flex-start'},
  13. crossAxisAlignment : {type:String, default:'flex-start'},
  14. customStyle : {type:String, default:''},
  15. customClasses : {type:Array, default:function(){return [];}}
  16. },
  17. data() {
  18. return {
  19. styleRuntime : '',
  20. classesRuntime : []
  21. }
  22. },
  23. methods:{
  24. makeStyle : function(){
  25. var styleRuntime = 'justify-content:'+this.mainAxisAlignment+'; ';
  26. styleRuntime += 'align-items:'+this.crossAxisAlignment+'; ';
  27. styleRuntime += this.customStyle;
  28. this.styleRuntime = styleRuntime;
  29. },
  30. makeClasses : function(){
  31. var classes = ['gui-flex', 'gui-column'];
  32. classes = classes.concat(this.customClasses);
  33. this.classesRuntime = classes;
  34. }
  35. },
  36. mounted:function(){
  37. this.makeStyle();
  38. this.makeClasses();
  39. },
  40. watch:{
  41. mainAxisAlignment : function(){this.makeStyle();},
  42. crossAxisAlignment : function(){this.makeStyle();},
  43. customStyle : function(){this.makeStyle();},
  44. customClasses : function(){this.makeClasses();}
  45. }
  46. }
  47. </script>
  48. <style scoped>
  49. </style>