|
@@ -6,7 +6,7 @@ import { Button, Dropdown } from "ant-design-vue";
|
|
|
import { cloneDeep } from "lodash";
|
|
|
import Modal from "queenjs/adapter/vue/components/modal";
|
|
|
import { defineComponent, nextTick, provide, ref } from "vue";
|
|
|
-import { any } from "vue-types";
|
|
|
+import { any, string } from "vue-types";
|
|
|
import { ShareBox } from "./ShareBox";
|
|
|
|
|
|
const NotFoundComp = () => <div>无效的组件</div>;
|
|
@@ -14,8 +14,10 @@ const NotFoundComp = () => <div>无效的组件</div>;
|
|
|
export default defineComponent({
|
|
|
props: {
|
|
|
data: any(),
|
|
|
+ previewType: string<"tpl" | "edit">().def("edit"),
|
|
|
},
|
|
|
- setup(props) {
|
|
|
+ emits: ["click"],
|
|
|
+ setup(props, { emit }) {
|
|
|
const editor = initEditor();
|
|
|
const { store, helper, controls } = editor;
|
|
|
const page = controls.pageCtrl;
|
|
@@ -93,7 +95,9 @@ export default defineComponent({
|
|
|
return (
|
|
|
<>
|
|
|
<div ref={compRef} style={pageStyles} class="overflow-hidden">
|
|
|
- <div class={["page", isShort && "swiper-wrapper relative "]}>
|
|
|
+ <div
|
|
|
+ class={["page select-none", isShort && "swiper-wrapper relative"]}
|
|
|
+ >
|
|
|
{controls.pageCtrl.streamCardIds.map((item) => {
|
|
|
const c = helper.findComp(item) as DesignComp;
|
|
|
const Comp =
|
|
@@ -124,7 +128,9 @@ export default defineComponent({
|
|
|
};
|
|
|
|
|
|
return () => {
|
|
|
- const { data } = props;
|
|
|
+ const { data, previewType } = props;
|
|
|
+
|
|
|
+ const isTpl = previewType == "tpl";
|
|
|
|
|
|
return (
|
|
|
<div class="h-100vh flex flex-col bg-[#0B0B0B] overflow-hidden">
|
|
@@ -136,15 +142,28 @@ export default defineComponent({
|
|
|
<IconExit class="text-20px mr-5px" /> 退出预览
|
|
|
</Button>
|
|
|
<span class="text-14px select-none">{data.title}</span>
|
|
|
- <Dropdown
|
|
|
- overlay={<ShareBox />}
|
|
|
- trigger="click"
|
|
|
- placement="bottomRight"
|
|
|
- >
|
|
|
- <Button class="text-dark-500 hover:text-dark-500" type="primary">
|
|
|
- 分享
|
|
|
+ {isTpl ? (
|
|
|
+ <Button
|
|
|
+ class="text-dark-500 hover:text-dark-500"
|
|
|
+ type="primary"
|
|
|
+ onClick={() => emit("click")}
|
|
|
+ >
|
|
|
+ 使用模板
|
|
|
</Button>
|
|
|
- </Dropdown>
|
|
|
+ ) : (
|
|
|
+ <Dropdown
|
|
|
+ overlay={<ShareBox />}
|
|
|
+ trigger="click"
|
|
|
+ placement="bottomRight"
|
|
|
+ >
|
|
|
+ <Button
|
|
|
+ class="text-dark-500 hover:text-dark-500"
|
|
|
+ type="primary"
|
|
|
+ >
|
|
|
+ 分享
|
|
|
+ </Button>
|
|
|
+ </Dropdown>
|
|
|
+ )}
|
|
|
</div>
|
|
|
<div
|
|
|
ref={pageRef}
|