|
@@ -6,11 +6,11 @@
|
|
|
<div class="quark-page-wrapper"
|
|
|
:style="getCommonStyle({...page.commonStyle, top: pageTop, height: pageData.height, width: pageData.width, position: 'relative'}, scalingRatio)">
|
|
|
<componentsTemplate
|
|
|
- v-for="(item, index) in page.elements"
|
|
|
- :key="index"
|
|
|
- @handleElementClick="handleElementClick"
|
|
|
- :element="item"
|
|
|
- :style="getCommonStyle(item.commonStyle, scalingRatio)">
|
|
|
+ v-for="(item, index) in page.elements"
|
|
|
+ :key="index"
|
|
|
+ @handleElementClick="handleElementClick"
|
|
|
+ :element="item"
|
|
|
+ :style="getCommonStyle(item.commonStyle, scalingRatio)">
|
|
|
</componentsTemplate>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -18,60 +18,74 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import editorProjectConfig from '@client/pages/editor/DataModel'
|
|
|
- import componentsTemplate from '../../components/components-template'
|
|
|
- import $config from '@client/config'
|
|
|
- import elementEvents from '@client/mixins/elementEvents'
|
|
|
- export default {
|
|
|
- name: 'engineH5Long',
|
|
|
- components: {
|
|
|
- componentsTemplate
|
|
|
- },
|
|
|
- mixins: [elementEvents],
|
|
|
- data() {
|
|
|
- return {
|
|
|
- getCommonStyle: editorProjectConfig.getCommonStyle,
|
|
|
- scalingRatio: 1,
|
|
|
- pageData: {
|
|
|
- pages: []
|
|
|
- },
|
|
|
- pageTop: 0
|
|
|
- }
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.pageData = window._pageData;
|
|
|
- this.scalingRatio = document.body.clientWidth / $config.canvasH5Width
|
|
|
- this.pageTop = (document.documentElement.clientHeight - this.pageData.height * this.scalingRatio) / 2
|
|
|
- this.pageTop = Math.max(this.pageTop, 0);
|
|
|
- },
|
|
|
- methods: {
|
|
|
- /**
|
|
|
- * 按钮点击事件
|
|
|
- * @param eventsData
|
|
|
- */
|
|
|
- async handleElementClick(eventsData, element) {
|
|
|
- for (let i = 0, len = eventsData.length; i < len; i++) {
|
|
|
- if (this['_event_' + eventsData[i].type]) {
|
|
|
- await this['_event_' + eventsData[i].type](eventsData[i], element, this.pageData)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+import editorProjectConfig from '@client/pages/editor/DataModel'
|
|
|
+import componentsTemplate from '../../components/components-template'
|
|
|
+import elementEvents from '@client/mixins/elementEvents'
|
|
|
+export default {
|
|
|
+ name: 'engine-pc',
|
|
|
+ components: {
|
|
|
+ componentsTemplate
|
|
|
+ },
|
|
|
+ mixins: [elementEvents],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ getCommonStyle: editorProjectConfig.getCommonStyle,
|
|
|
+ scalingRatio: 1,
|
|
|
+ pageData: {
|
|
|
+ pages: []
|
|
|
+ },
|
|
|
+ pageTop: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.pageData = window._pageData;
|
|
|
+ this.computedPageStyle()
|
|
|
+
|
|
|
+ window.addEventListener('resize', this.computedPageStyle)
|
|
|
+ },
|
|
|
+ destroyed() {
|
|
|
+ window.removeEventListener('resize', this.computedPageStyle)
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ computedPageStyle () {
|
|
|
+ let width = document.body.clientWidth
|
|
|
+ if (width < 1200) {
|
|
|
+ width = 1200
|
|
|
+ }
|
|
|
+ this.scalingRatio = 1
|
|
|
+ this.pageTop = (document.documentElement.clientHeight - this.pageData.height * this.scalingRatio) / 2
|
|
|
+ this.pageTop = Math.max(this.pageTop, 0);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 按钮点击事件
|
|
|
+ * @param eventsData
|
|
|
+ */
|
|
|
+ async handleElementClick(eventsData, element) {
|
|
|
+ for (let i = 0, len = eventsData.length; i < len; i++) {
|
|
|
+ if (this['_event_' + eventsData[i].type]) {
|
|
|
+ await this['_event_' + eventsData[i].type](eventsData[i], element, this.pageData)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
- .engine-template-wrapper {
|
|
|
- position: relative;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
+.engine-template-wrapper {
|
|
|
+ position: relative;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+}
|
|
|
+.quark-page-wrapper {
|
|
|
+ margin: 0 auto;
|
|
|
+}
|
|
|
|
|
|
- .relative {
|
|
|
- position: relative;
|
|
|
- }
|
|
|
+.relative {
|
|
|
+ position: relative;
|
|
|
+}
|
|
|
|
|
|
- .hidden {
|
|
|
- overflow: hidden;
|
|
|
- }
|
|
|
+.hidden {
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
</style>
|