@opentiny/vue-docs 3.21.2 → 3.21.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,16 +43,13 @@ npm install @opentiny/vue@3
43
43
  Then modify the`vite.config.js`, add the following code highlighted section:
44
44
 
45
45
  ```js {8-10}
46
- //vite.config.js
46
+ // vite.config.js
47
47
 
48
48
  import { defineConfig } from 'vite'
49
49
  import vue from '@vitejs/plugin-vue'
50
50
 
51
51
  export default defineConfig({
52
- plugins: [vue()],
53
- define: {
54
- 'process.env': { ...process.env }
55
- }
52
+ plugins: [vue()]
56
53
  })
57
54
  ```
58
55
 
@@ -49,10 +49,7 @@ import { defineConfig } from 'vite'
49
49
  import vue from '@vitejs/plugin-vue'
50
50
 
51
51
  export default defineConfig({
52
- plugins: [vue()],
53
- define: {
54
- 'process.env': { ...process.env }
55
- }
52
+ plugins: [vue()]
56
53
  })
57
54
  ```
58
55
 
@@ -31,7 +31,7 @@ yarn add @opentiny/vue@2
31
31
  npm install @opentiny/vue@2
32
32
  ```
33
33
 
34
- If it's`Vite`After the dependency is installed, modify the project.`vite.config.js`, add the following code highlighted section:
34
+ <code>@opentiny/vue</code>Supports multiple modes. If you are a `Vite` project and not a mobile client, you can modify the `vite.config.js` of the project by adding the highlighted parts of the following code, so that the project can shake off the mobile mode code during construction and optimize the volume of the packaged product:
35
35
 
36
36
  ```js {8-10}
37
37
  // vite.config.js
@@ -42,15 +42,14 @@ import vue from '@vitejs/plugin-vue'
42
42
  export default defineConfig({
43
43
  plugins: [vue()],
44
44
  define: {
45
- 'process.env': { ...process.env }
45
+ 'process.env': { TINY_MODE: 'pc' }
46
46
  }
47
47
  })
48
48
  ```
49
49
 
50
50
  <div class="tip custom-block">
51
- <p> To avoid the uncertainty associated with monthly (minor) upgrades of <code> @opentiny/vue </code>, it is recommended to use ~ before relying on the version number of the package in <code> package.json </code> in your project.
52
- For example, <code>"@opentiny/vue": "~3.12.0</code>. </p>
53
- <p><code> @opentiny/vue </code> supports multiple modes. If your project is not a mobile project, you can declare the value of <code>TINY_MODE</code> in <code>process.env</code> in the above configuration code. In order to make the project during construction, the mobile side code can be shaken off and the volume of the packaged product can be optimized. For example, <code>'process.env': {... env,TINY_MODE:'pc'}</code>. </p>
51
+ <p>To avoid the uncertainty caused by monthly minor upgrades of<code>@opentiny/vue</code>, it is recommended to use ~ before the version number of the dependent package in <code>package.json</code> in your project,
52
+ For example,<code>"@opentiny/vue": "~3.12.0"</code>.</p>
54
53
  </div>
55
54
 
56
55
  ## Import through CDN
@@ -31,7 +31,7 @@ yarn add @opentiny/vue@2
31
31
  npm install @opentiny/vue@2
32
32
  ```
33
33
 
34
- 如果是`Vite` 工程,安装完依赖后,修改项目的 `vite.config.js` ,添加以下代码突出显示的部分:
34
+ <code> @opentiny/vue </code> 支持多种模式。如果您是 `Vite` 工程且非移动端,可以修改项目的 `vite.config.js`,添加以下代码突出显示的部分,以使工程在构建时,能将移动端模式的代码摇掉,优化打包产物的体积:
35
35
 
36
36
  ```js {8-10}
37
37
  // vite.config.js
@@ -42,15 +42,14 @@ import vue from '@vitejs/plugin-vue'
42
42
  export default defineConfig({
43
43
  plugins: [vue()],
44
44
  define: {
45
- 'process.env': { ...process.env }
45
+ 'process.env': { TINY_MODE: 'pc' }
46
46
  }
47
47
  })
48
48
  ```
49
49
 
50
50
  <div class="tip custom-block">
51
51
  <p>为了避免<code> @opentiny/vue </code> 的月度版本 (minor) 升级带来的不确定因素,因此推荐在您的工程中的<code> package.json </code> 中依赖包的版本号前使用 ~,
52
- 比如 <code>"@opentiny/vue": "~3.12.0</code>。</p>
53
- <p><code> @opentiny/vue </code> 支持多种模式。如果您的工程非移动端工程,可以在上面配置代码中的<code>process.env</code>中,声明<code>TINY_MODE</code>的值,以使工程在构建时,能将移动端模式的代码摇掉,优化打包产物的体积。比如 <code>'process.env': { ...process.env,TINY_MODE:'pc' }</code>。</p>
52
+ 比如 <code>"@opentiny/vue": "~3.12.0"</code>。</p>
54
53
  </div>
55
54
 
56
55
  ## 通过 CDN 方式引入 (v3.16.0 及之前的版本可用)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-docs",
3
- "version": "3.21.2",
3
+ "version": "3.21.4",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
6
  "@docsearch/css": "^3.8.0",
@@ -20,19 +20,19 @@
20
20
  "vue-i18n": "^9.1.10",
21
21
  "vue-router": "4.1.5",
22
22
  "@opentiny/vue": "~3.21.2",
23
+ "@opentiny/vue-design-smb": "~3.21.0",
23
24
  "@opentiny/vue-design-aurora": "~3.21.0",
24
- "@opentiny/vue-common": "~3.21.0",
25
25
  "@opentiny/vue-design-saas": "~3.21.0",
26
- "@opentiny/vue-directive": "~3.21.0",
27
- "@opentiny/vue-icon": "~3.21.0",
28
- "@opentiny/vue-design-smb": "~3.21.0",
29
26
  "@opentiny/vue-hooks": "~3.21.0",
27
+ "@opentiny/vue-icon": "~3.21.0",
28
+ "@opentiny/vue-directive": "~3.21.0",
29
+ "@opentiny/vue-common": "~3.21.0",
30
30
  "@opentiny/vue-icon-multicolor": "~3.21.0",
31
- "@opentiny/vue-theme": "~3.21.0",
31
+ "@opentiny/vue-theme-mobile": "~3.21.0",
32
32
  "@opentiny/vue-icon-saas": "~3.21.0",
33
+ "@opentiny/vue-theme": "~3.21.2",
33
34
  "@opentiny/vue-theme-saas": "~3.21.0",
34
- "@opentiny/vue-vite-import": "~1.2.0",
35
- "@opentiny/vue-theme-mobile": "~3.21.0"
35
+ "@opentiny/vue-vite-import": "~1.2.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@playwright/test": "~1.49.0",
@@ -1,5 +1,24 @@
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,10 +30,33 @@
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;