zhengyiming
17 小时以前 55119aeab85c9dc310ab8bc3de3091a20fa9a684
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<template>
  <el-header>
    <div class="left">
      <el-divider direction="vertical" />
 
      <!-- 导入 -->
      <!-- <import-Json></import-Json> -->
      <!-- <Divider type="vertical" /> -->
      <!-- <import-file></import-file> -->
      <!-- <Divider type="vertical" /> -->
      <!-- <Button type="text" to="/template" target="_blank">全部模板</Button>
      <Divider type="vertical" /> -->
 
      <!-- <myTemplName></myTemplName> -->
      <!-- 标尺开关 -->
      <el-tooltip :content="'网格'">
        <el-switch v-model="toggleModel" size="small" class="switch"></el-switch>
      </el-tooltip>
      <el-divider direction="vertical" />
      <!-- <history></history> -->
    </div>
 
    <div class="center" v-if="templateImageList.length > 0">
      <el-pagination
        layout="prev, pager, next"
        :page-count="templateImageList.length"
        :current-page="templateEditState.currentImageIndex + 1"
        @current-change="handleCurrentChange"
      />
    </div>
 
    <div class="right">
      <!-- <a href="https://pro.kuaitu.cc/" target="_blank" alt="商业版">
        <img width="15" :src="proIcon" alt="vue-fbric-editor" />
      </a> -->
      <!-- 管理员模式 -->
      <!-- <admin /> -->
      <!-- 预览 -->
      <!-- <previewCurrent /> -->
      <!-- <waterMark /> -->
      <saveV2></saveV2>
      <!-- <login></login> -->
      <!-- <lang></lang> -->
    </div>
  </el-header>
</template>
 
<script name="Top" setup lang="ts">
import history from '@/fabric-editor/components/history.vue';
import saveV2 from '@/fabric-editor/components/saveV2.vue';
import { useTemplateDetailContext, useCanvasActions } from '../../hooks/context';
 
const props = defineProps(['ruler']);
const emit = defineEmits(['update:ruler']);
 
const toggleModel = computed({
  get() {
    return props.ruler;
  },
  set(value) {
    emit('update:ruler', value);
  },
});
 
const { templateImageList, templateEditState } = useTemplateDetailContext();
const { toggleCanvas } = useCanvasActions();
 
function handleCurrentChange(val: number) {
  toggleCanvas(val - 1);
}
</script>
 
<style lang="scss" scoped>
.left,
.right {
  display: flex;
  align-items: center;
 
  img {
    display: block;
    margin-right: 10px;
  }
}
 
.center {
  display: flex;
  align-items: center;
}
</style>