返回 slidev
ExportPdfTip.vue
根目录 / packages / client / internals / ExportPdfTip.vue
1 <script setup lang="ts">
2 import { useVModel } from '@vueuse/core'
3 import { skipExportPdfTip } from '../state'
4 import Modal from './Modal.vue'
5
6 const props = defineProps({
7 modelValue: {
8 default: false,
9 },
10 })
11
12 const emit = defineEmits(['update:modelValue', 'print'])
13 const value = useVModel(props, 'modelValue', emit)
14
15 function print() {
16 value.value = false
17 emit('print')
18 }
19 </script>
20
21 <template>
22 <Modal v-model="value" class="px-6 py-4 flex flex-col gap-2">
23 <div class="flex gap-2 text-xl">
24 <div class="i-carbon:information my-auto" /> Tips
25 </div>
26 <div>
27 Slidev will open your browser's built-in print dialog to export the slides as PDF. <br>
28 In the print dialog, please:
29 <ul class="list-disc my-4 pl-4">
30 <li>
31 Choose "Save as PDF" as the Destination.
32 <span class="op-70 text-xs"> (Not "Microsoft Print to PDF") </span>
33 </li>
34 <li> Choose "Default" as the Margin. </li>
35 <li> Toggle on "Print backgrounds". </li>
36 </ul>
37 <div class="mb-2 op-70 text-sm">
38 If you're encountering problems, please try
39 <a href="https://sli.dev/builtin/cli#export"> the CLI </a>
40 or
41 <a href="https://github.com/slidevjs/slidev/issues/new"> open an issue</a>.
42 </div>
43 <div class="form-check op-70">
44 <input
45 v-model="skipExportPdfTip"
46 name="record-camera"
47 type="checkbox"
48 >
49 <label for="record-camera" @click="skipExportPdfTip = !skipExportPdfTip">Don't show this dialog next time.</label>
50 </div>
51 </div>
52 <div class="flex my-1">
53 <button class="cancel" @click="value = false">
54 Cancel
55 </button>
56 <div class="flex-auto" />
57 <button @click="print">
58 Start
59 </button>
60 </div>
61 </Modal>
62 </template>
63
64 <style scoped>
65 button {
66 @apply bg-blue-400 text-white px-4 py-1 rounded border-b-2 border-blue-600;
67 @apply hover:(bg-blue-500 border-blue-700);
68 }
69
70 button.cancel {
71 @apply bg-gray-400 bg-opacity-50 text-white px-4 py-1 rounded border-b-2 border-main;
72 @apply hover:(bg-opacity-75 border-opacity-75);
73 }
74
75 a {
76 @apply border-current border-b border-dashed hover:text-primary hover:border-solid;
77 }
78
79 .form-check {
80 @apply leading-5;
81
82 * {
83 @apply my-auto align-middle;
84 }
85
86 label {
87 @apply ml-1 text-sm select-none;
88 }
89 }
90 </style>
91
91 lines Plain Text