|
1 | 1 | <template> |
2 | 2 | <div class="ti-f-r ti-pt48 ti-pl48 ti-pr48 docs-container"> |
| 3 | + <tiny-modal v-model="showModal" title="请注意" status="warning" show-footer> |
| 4 | + <div class="modal-body"> |
| 5 | + TinyVue 从 <span class="modal-body-keyword">3.13.0</span> 开始不需要在 |
| 6 | + <span class="modal-body-keyword">vite.config.js</span> 文件中配置 |
| 7 | + <span class="modal-body-keyword">define: { 'process.env': { ...process.env } }</span> |
| 8 | + 这段代码,这段代码会导致环境变量被打包到构建产物中,引起信息安全风险,请业务尽快升级到 |
| 9 | + <span class="modal-body-keyword">3.13.0</span> 或以上版本!如果不升级版本可以改成:<span |
| 10 | + class="modal-body-keyword" |
| 11 | + >define: { 'process.env': { }}</span |
| 12 | + > |
| 13 | + 同样也可以解决此问题!感谢您对 TinyVue 的支持! |
| 14 | + </div> |
| 15 | + <template #footer> |
| 16 | + <tiny-button type="primary" :disabled="disabled" @click="handleConfirm">{{ |
| 17 | + disabled ? `${time} S后可关闭此提示` : '确认将不再弹出此提示' |
| 18 | + }}</tiny-button> |
| 19 | + <tiny-button @click="handleCancel">取消</tiny-button> |
| 20 | + </template> |
| 21 | + </tiny-modal> |
3 | 22 | <component id="doc_wrap" :is="docCmp" class="ti-w0 ti-fi-1" /> |
4 | 23 | <!-- 目录列表 TODO: 需要锚点组件配置整改,处理id中的特殊字符 --> |
5 | 24 | <!-- <div v-if="anchorLinks.length > 0" class="docs-page-anchor catalog w128 sticky top32 ml24"> |
|
11 | 30 |
|
12 | 31 | <script setup> |
13 | 32 | import { ref, nextTick, watch, onMounted, shallowRef } from 'vue' |
| 33 | +import { Modal as TinyModal, Button as TinyButton } from '@opentiny/vue' |
14 | 34 | import { getWord } from '@/tools' |
15 | 35 | import docMDs from './docConfig.js' |
16 | 36 | import { router } from '@/router.js' |
17 | 37 |
|
| 38 | +const tipFlag = localStorage.getItem('tiny-vue-env-tip') |
| 39 | +const showModal = ref(tipFlag !== 'never') |
| 40 | +const disabled = ref(true) |
| 41 | +let time = ref(5) |
| 42 | +if (showModal.value) { |
| 43 | + let timer = setInterval(() => { |
| 44 | + if (time.value > 0) { |
| 45 | + time.value = time.value - 1 |
| 46 | + } else { |
| 47 | + disabled.value = false |
| 48 | + clearInterval(timer) |
| 49 | + timer = null |
| 50 | + } |
| 51 | + }, 1000) |
| 52 | +} |
| 53 | +const handleConfirm = () => { |
| 54 | + showModal.value = false |
| 55 | + localStorage.setItem('tiny-vue-env-tip', 'never') |
| 56 | +} |
| 57 | +const handleCancel = () => { |
| 58 | + showModal.value = false |
| 59 | +} |
18 | 60 | const isOpen = import.meta.env.VITE_BUILD_TARGET === 'open' |
19 | 61 | const openDocMap = { |
20 | 62 | 'envpreparation': 'envpreparation-open' |
@@ -54,6 +96,9 @@ onMounted(() => { |
54 | 96 | </script> |
55 | 97 |
|
56 | 98 | <style lang="less"> |
| 99 | +.modal-body .modal-body-keyword { |
| 100 | + color: var(--tv-base-color-error-6); |
| 101 | +} |
57 | 102 | .docs-container { |
58 | 103 | flex: 1; |
59 | 104 | display: flex; |
|
0 commit comments