2022-10-07 23:02:40 +09:00
|
|
|
<template>
|
|
|
|
<div class="preview-root">
|
|
|
|
<div class="preview-ctn">
|
2023-02-05 23:25:44 +09:00
|
|
|
<PreviewString v-for="c in previews"
|
|
|
|
:key="c.key" :config="c" :version="_version" />
|
2023-02-06 04:35:42 +09:00
|
|
|
<PreviewString v-for="c,i in config.CustomizedDisplay||[]"
|
|
|
|
:key="'CustomizedDisplay-'+i" :config="c" :version="_version" />
|
|
|
|
<ControllerPreview v-if="config.controller" :config="config.controller" />
|
2022-10-07 23:02:40 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-02-05 23:25:44 +09:00
|
|
|
import {previewIds} from './codes/preview.js';
|
2023-02-06 04:35:42 +09:00
|
|
|
import ControllerPreview from './codes/controller/preview.vue';
|
|
|
|
|
2022-10-07 23:02:40 +09:00
|
|
|
export default {
|
2023-02-06 04:35:42 +09:00
|
|
|
components: {
|
|
|
|
ControllerPreview,
|
|
|
|
},
|
2022-10-07 23:02:40 +09:00
|
|
|
props: {
|
|
|
|
config: {type: Object},
|
|
|
|
},
|
|
|
|
computed: {
|
2023-01-29 04:39:18 +09:00
|
|
|
_version() {
|
2023-02-05 23:25:44 +09:00
|
|
|
const {_version} = this.config;
|
2023-01-29 04:39:18 +09:00
|
|
|
return _version;
|
2022-10-30 04:19:16 +09:00
|
|
|
},
|
2023-02-05 23:25:44 +09:00
|
|
|
previews() {
|
|
|
|
return previewIds.flatMap(id => {
|
|
|
|
const config = /**@type{any}*/(this.config)[id];
|
2023-02-06 04:35:42 +09:00
|
|
|
// special
|
|
|
|
if (['controller', 'CustomizedDisplay'].includes(id)) return [];
|
2023-02-05 23:25:44 +09:00
|
|
|
if (config == null) return [];
|
2023-02-06 04:35:42 +09:00
|
|
|
return {...config, key: id};
|
2023-02-05 23:25:44 +09:00
|
|
|
});
|
|
|
|
},
|
2022-10-07 23:02:40 +09:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
2023-01-29 04:39:18 +09:00
|
|
|
.preview-root {
|
2022-10-07 23:02:40 +09:00
|
|
|
position: relative;
|
|
|
|
width: 600px;
|
|
|
|
height: 448px;
|
|
|
|
background: url(/img/preview/background.png);
|
|
|
|
padding: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
2023-01-29 04:39:18 +09:00
|
|
|
.preview-ctn {
|
2022-10-07 23:02:40 +09:00
|
|
|
position: absolute;
|
|
|
|
top: -16px;
|
|
|
|
}
|
|
|
|
</style>
|