Appletter.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <div>
  3. <div class="iframe-wrap">
  4. <iframe :src="this.global.h5BaseUrl" allowtransparency="true" frameborder="0" scrolling="auto" width="420" class="iframe" ref="homePage"></iframe>
  5. </div>
  6. </div>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. clientHeight: "",
  13. };
  14. },
  15. mounted() {
  16. // 获取浏览器可视区域高度
  17. this.clientHeight = `${document.documentElement.clientHeight}`; //document.body.clientWidth;
  18. //console.log(self.clientHeight);
  19. window.onresize = function temp() {
  20. this.clientHeight = `${document.documentElement.clientHeight}`;
  21. };
  22. },
  23. watch: {
  24. // 如果 `clientHeight` 发生改变,这个函数就会运行
  25. clientHeight: function () {
  26. this.changeFixed(this.clientHeight);
  27. },
  28. },
  29. created() { },
  30. methods: {
  31. changeFixed(clientHeight) {
  32. //动态修改样式
  33. this.$refs.homePage.style.height = clientHeight - 120 + "px";
  34. },
  35. },
  36. };
  37. </script>
  38. <style scoped lang="scss">
  39. .iframe-wrap {
  40. display: flex;
  41. justify-content: center;
  42. align-items: center;
  43. }
  44. .demo-table-expand {
  45. font-size: 0;
  46. padding: 20px;
  47. box-sizing: border-box;
  48. }
  49. .demo-table-expand label {
  50. width: 90px;
  51. color: #99a9bf;
  52. }
  53. .demo-table-expand .el-form-item {
  54. margin-right: 0;
  55. margin-bottom: 0;
  56. width: 50%;
  57. }
  58. </style>