tm-fullView.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view
  3. class="tm-fullView fulled "
  4. :class="[$tm.vx.state().tmVuetify.black ? 'grey-darken-6 bk' : '',classCus,text?'text':'',bgColor]"
  5. :style="{
  6. width: width?(width + 'px'):'100%',
  7. minHeight: height?(height + 'px'):'100%'
  8. }"
  9. >
  10. <slot name="default" :info="{width:width,height:height,sysinfo:sysinfo}"></slot>
  11. </view>
  12. </template>
  13. <script>
  14. /**
  15. * 满屏
  16. * @description 满屏,即占满一屏,用于单页使用。
  17. * @property {String|Array} class-name = [] 默认 '',自定义类
  18. * @property {String} bg-color = [] 默认 'grey',背景颜色
  19. * @property {Boolean} text = [true|false] 默认 true,淡背景模式。
  20. * @example <tm-fullView ></tm-fullView>
  21. */
  22. export default {
  23. name: 'tm-fullView',
  24. props:{
  25. className:{
  26. type:String|Array,
  27. default:''
  28. },
  29. bgColor:{
  30. type:String,
  31. default:'grey'
  32. },
  33. text:{
  34. type:Boolean|String,
  35. default:true
  36. }
  37. },
  38. computed:{
  39. classCus:function(){
  40. if(typeof this.className === 'string') return this.className;
  41. if(typeof this.className === 'object' && Array.isArray(this.className)){
  42. return this.className.join(" ");
  43. }
  44. }
  45. },
  46. data() {
  47. return {
  48. width: 0,
  49. height: 0,
  50. sysinfo:null,
  51. };
  52. },
  53. created(){
  54. this.sysinfo = uni.getSystemInfoSync();
  55. this.width = this.sysinfo.windowWidth;
  56. this.height = this.sysinfo.windowHeight;
  57. },
  58. mounted() {
  59. }
  60. };
  61. </script>
  62. <style lang="scss" scoped>
  63. .tm-fullView{
  64. .tm-fullView-body{
  65. margin: 0;
  66. padding:0;
  67. }
  68. }
  69. </style>