@opentiny/vue-docs 3.19.4 → 3.19.6

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.
Files changed (38) hide show
  1. package/demos/pc/app/form/basic-usage-composition-api.vue +5 -5
  2. package/demos/pc/app/form/basic-usage.spec.ts +0 -4
  3. package/demos/pc/app/form/basic-usage.vue +4 -4
  4. package/demos/pc/app/form/custom-validation-rule-composition-api.vue +1 -1
  5. package/demos/pc/app/form/custom-validation-rule.vue +1 -1
  6. package/demos/pc/app/form/display-only-composition-api.vue +19 -20
  7. package/demos/pc/app/form/display-only.spec.ts +4 -4
  8. package/demos/pc/app/form/display-only.vue +19 -20
  9. package/demos/pc/app/form/form-disabled-composition-api.vue +26 -33
  10. package/demos/pc/app/form/form-disabled.spec.js +30 -30
  11. package/demos/pc/app/form/form-disabled.vue +26 -34
  12. package/demos/pc/app/form/form-validate-field-composition-api.vue +2 -2
  13. package/demos/pc/app/form/form-validate-field.vue +2 -2
  14. package/demos/pc/app/form/form-validation-composition-api.vue +8 -8
  15. package/demos/pc/app/form/form-validation.spec.ts +3 -3
  16. package/demos/pc/app/form/form-validation.vue +9 -8
  17. package/demos/pc/app/form/size-composition-api.vue +4 -4
  18. package/demos/pc/app/form/size.vue +4 -4
  19. package/demos/pc/app/form/validate-debounce-composition-api.vue +1 -1
  20. package/demos/pc/app/form/validate-debounce.vue +1 -1
  21. package/demos/pc/app/grid/editor/popeditor-in-grid-remote-search-composition-api.vue +1 -1
  22. package/demos/pc/app/grid/editor/popeditor-in-grid-remote-search.vue +1 -1
  23. package/demos/pc/app/grid/empty/empty-data-tip-composition-api.vue +1 -1
  24. package/demos/pc/app/grid/empty/empty-data-tip.vue +1 -1
  25. package/demos/pc/app/grid/operation-column/selection-config-composition-api.vue +0 -1
  26. package/demos/pc/app/grid/webdoc/grid-editor.js +2 -2
  27. package/demos/pc/app/hrapprover/basic-usage-composition-api.vue +1 -0
  28. package/demos/pc/app/hrapprover/basic-usage.vue +1 -0
  29. package/demos/pc/app/hrapprover/category-type-composition-api.vue +1 -0
  30. package/demos/pc/app/hrapprover/category-type.vue +1 -0
  31. package/demos/pc/app/hrapprover/custom-service-composition-api.vue +1 -0
  32. package/demos/pc/app/hrapprover/custom-service.vue +1 -0
  33. package/demos/pc/app/hrapprover/disabled-composition-api.vue +1 -0
  34. package/demos/pc/app/hrapprover/disabled.vue +1 -0
  35. package/package.json +9 -9
  36. package/playground/App.vue +61 -36
  37. package/src/views/components/components.vue +13 -13
  38. package/src/views/layout/layout.vue +4 -2
@@ -12,8 +12,8 @@
12
12
  </tiny-form-item>
13
13
  <tiny-form-item>
14
14
  <tiny-button type="primary" @click="validateField"> 校验 </tiny-button>
15
- <tiny-button type="primary" @click="clearValidate"> 移除校验 </tiny-button>
16
- <tiny-button type="primary" @click="resetField"> 重置日期 </tiny-button>
15
+ <tiny-button @click="clearValidate"> 移除校验 </tiny-button>
16
+ <tiny-button @click="resetField"> 重置日期 </tiny-button>
17
17
  </tiny-form-item>
18
18
  </tiny-form>
19
19
  </div>
@@ -4,6 +4,12 @@
4
4
  <div>validate用法:<tiny-button-group :data="validTypeList" v-model="validType"></tiny-button-group></div>
5
5
  </div>
6
6
  <tiny-form ref="ruleFormRef" :model="createData" :rules="rules" label-width="100px">
7
+ <tiny-form-item label="等级" prop="radio">
8
+ <tiny-radio-group v-model="createData.radio" :options="options"></tiny-radio-group>
9
+ </tiny-form-item>
10
+ <tiny-form-item label="IP字段" prop="ip">
11
+ <tiny-ip-address v-model="createData.ip"></tiny-ip-address>
12
+ </tiny-form-item>
7
13
  <tiny-form-item label="必填" prop="users" :validate-icon="validateIcon">
8
14
  <tiny-input v-model="createData.users"></tiny-input>
9
15
  </tiny-form-item>
@@ -13,24 +19,18 @@
13
19
  <tiny-form-item label="URL" prop="url">
14
20
  <tiny-input v-model="createData.url"></tiny-input>
15
21
  </tiny-form-item>
16
- <tiny-form-item label="等级" prop="radio">
17
- <tiny-radio-group v-model="createData.radio" :options="options"></tiny-radio-group>
18
- </tiny-form-item>
19
22
  <tiny-form-item label="邮件" prop="email">
20
23
  <tiny-input v-model="createData.email"></tiny-input>
21
24
  </tiny-form-item>
22
25
  <tiny-form-item label="数字" prop="num1">
23
26
  <tiny-numeric v-model="createData.num1"></tiny-numeric>
24
27
  </tiny-form-item>
25
- <tiny-form-item label="IP字段" prop="ip">
26
- <tiny-ip-address v-model="createData.ip"></tiny-ip-address>
27
- </tiny-form-item>
28
28
  <tiny-form-item>
29
29
  <tiny-button type="primary" @click="validType === 'callback' ? handleSubmit() : handleSubmitPromise()">
30
30
  提交
31
31
  </tiny-button>
32
- <tiny-button type="primary" @click="clearFormValid"> 移除校验 </tiny-button>
33
- <tiny-button type="primary" @click="resetForm"> 重置表单 </tiny-button>
32
+ <tiny-button @click="clearFormValid"> 移除校验 </tiny-button>
33
+ <tiny-button @click="resetForm"> 重置表单 </tiny-button>
34
34
  </tiny-form-item>
35
35
  </tiny-form>
36
36
  </div>
@@ -27,7 +27,7 @@ test('测试表单输入变化和失焦是否出现校验', async ({ page }) =>
27
27
  const requiredTip = page.getByRole('tooltip', { name: '必填' })
28
28
 
29
29
  // 对长度有要求的检验
30
- const firstInput = formItem.first().locator('input')
30
+ const firstInput = formItem.nth(2).locator('input')
31
31
  await firstInput.click()
32
32
  await firstInput.blur()
33
33
  await expect(requiredTip.first()).toBeVisible()
@@ -48,7 +48,7 @@ test('测试表单输入变化和失焦是否出现校验', async ({ page }) =>
48
48
  await expect(page.getByRole('tooltip', { name: '不符合规则的日期格式' })).not.toBeVisible()
49
49
 
50
50
  // url输入框
51
- const urlInput = formItem.nth(2).locator('input')
51
+ const urlInput = formItem.nth(4).locator('input')
52
52
  const validUrl = 'https://test.com'
53
53
  urlInput.fill('1111')
54
54
  await expect(page.getByRole('tooltip', { name: '非法 URL 地址' })).toBeVisible()
@@ -56,7 +56,7 @@ test('测试表单输入变化和失焦是否出现校验', async ({ page }) =>
56
56
  await expect(page.getByRole('tooltip', { name: '非法 URL 地址' })).not.toBeVisible()
57
57
 
58
58
  // email输入框
59
- const emailInput = formItem.nth(4).locator('input')
59
+ const emailInput = formItem.nth(5).locator('input')
60
60
  const validEmail = '111@test.com'
61
61
  emailInput.fill('1111')
62
62
  await expect(page.getByRole('tooltip', { name: '非法邮件地址' })).toBeVisible()
@@ -4,6 +4,12 @@
4
4
  <div>validate用法:<tiny-button-group :data="validTypeList" v-model="validType"></tiny-button-group></div>
5
5
  </div>
6
6
  <tiny-form ref="ruleFormRef" :model="createData" :rules="rules" label-width="100px">
7
+ <tiny-form-item label="等级" prop="radio">
8
+ <tiny-radio-group v-model="createData.radio" :options="options"></tiny-radio-group>
9
+ </tiny-form-item>
10
+ <tiny-form-item label="IP字段" prop="ip">
11
+ <tiny-ip-address v-model="createData.ip"></tiny-ip-address>
12
+ </tiny-form-item>
7
13
  <tiny-form-item label="必填" prop="users" :validate-icon="validateIcon">
8
14
  <tiny-input v-model="createData.users"></tiny-input>
9
15
  </tiny-form-item>
@@ -13,24 +19,19 @@
13
19
  <tiny-form-item label="URL" prop="url">
14
20
  <tiny-input v-model="createData.url"></tiny-input>
15
21
  </tiny-form-item>
16
- <tiny-form-item label="等级" prop="radio">
17
- <tiny-radio-group v-model="createData.radio" :options="options"></tiny-radio-group>
18
- </tiny-form-item>
22
+
19
23
  <tiny-form-item label="邮件" prop="email">
20
24
  <tiny-input v-model="createData.email"></tiny-input>
21
25
  </tiny-form-item>
22
26
  <tiny-form-item label="数字" prop="num1">
23
27
  <tiny-numeric v-model="createData.num1"></tiny-numeric>
24
28
  </tiny-form-item>
25
- <tiny-form-item label="IP字段" prop="ip">
26
- <tiny-ip-address v-model="createData.ip"></tiny-ip-address>
27
- </tiny-form-item>
28
29
  <tiny-form-item>
29
30
  <tiny-button type="primary" @click="validType === 'callback' ? handleSubmit() : handleSubmitPromise()">
30
31
  提交
31
32
  </tiny-button>
32
- <tiny-button type="primary" @click="clearFormValid"> 移除校验 </tiny-button>
33
- <tiny-button type="primary" @click="resetForm"> 重置表单 </tiny-button>
33
+ <tiny-button @click="clearFormValid"> 移除校验 </tiny-button>
34
+ <tiny-button @click="resetForm"> 重置表单 </tiny-button>
34
35
  </tiny-form-item>
35
36
  </tiny-form>
36
37
  </div>
@@ -2,13 +2,13 @@
2
2
  <div class="demo-form">
3
3
  <div class="mb-12">表单尺寸: <tiny-button-group :data="sizeList" v-model="sizeValue"></tiny-button-group></div>
4
4
  <tiny-form ref="createData" label-width="100px" :size="sizeValue" label-position="right">
5
- <tiny-form-item label="数字">
6
- <tiny-numeric v-model="createData.quantity"></tiny-numeric>
7
- </tiny-form-item>
8
5
  <tiny-form-item label="单选">
9
6
  <tiny-radio v-model="createData.sex" label="1"> 男 </tiny-radio>
10
7
  <tiny-radio v-model="createData.sex" label="2" text="女"></tiny-radio>
11
8
  </tiny-form-item>
9
+ <tiny-form-item label="数字">
10
+ <tiny-numeric v-model="createData.quantity"></tiny-numeric>
11
+ </tiny-form-item>
12
12
  <tiny-form-item label="日期">
13
13
  <tiny-date-picker v-model="createData.datepicker"></tiny-date-picker>
14
14
  </tiny-form-item>
@@ -17,7 +17,7 @@
17
17
  </tiny-form-item>
18
18
  <tiny-form-item label="提示">
19
19
  <tiny-tooltip effect="light" content="TinyUI Form Demo" placement="right">
20
- <tiny-input v-model="createData.input" placeholder="click"></tiny-input>
20
+ <tiny-input v-model="createData.input"></tiny-input>
21
21
  </tiny-tooltip>
22
22
  </tiny-form-item>
23
23
  <tiny-form-item label="文本">
@@ -2,13 +2,13 @@
2
2
  <div class="demo-form">
3
3
  <div class="mb-12">表单尺寸: <tiny-button-group :data="sizeList" v-model="sizeValue"></tiny-button-group></div>
4
4
  <tiny-form ref="createData" label-width="100px" :size="sizeValue" label-position="right">
5
- <tiny-form-item label="数字">
6
- <tiny-numeric v-model="createData.quantity"></tiny-numeric>
7
- </tiny-form-item>
8
5
  <tiny-form-item label="单选">
9
6
  <tiny-radio v-model="createData.sex" label="1"> 男 </tiny-radio>
10
7
  <tiny-radio v-model="createData.sex" label="2" text="女"></tiny-radio>
11
8
  </tiny-form-item>
9
+ <tiny-form-item label="数字">
10
+ <tiny-numeric v-model="createData.quantity"></tiny-numeric>
11
+ </tiny-form-item>
12
12
  <tiny-form-item label="日期">
13
13
  <tiny-date-picker v-model="createData.datepicker"></tiny-date-picker>
14
14
  </tiny-form-item>
@@ -17,7 +17,7 @@
17
17
  </tiny-form-item>
18
18
  <tiny-form-item label="提示">
19
19
  <tiny-tooltip effect="light" content="TinyUI Form Demo" placement="right">
20
- <tiny-input v-model="createData.input" placeholder="click"></tiny-input>
20
+ <tiny-input v-model="createData.input"></tiny-input>
21
21
  </tiny-tooltip>
22
22
  </tiny-form-item>
23
23
  <tiny-form-item label="文本">
@@ -8,8 +8,8 @@
8
8
  <tiny-input v-model="createData.user2"></tiny-input>
9
9
  </tiny-form-item>
10
10
  <tiny-form-item>
11
- <tiny-button type="success" @click="clearFormValid">移除表单校验</tiny-button>
12
11
  <tiny-button type="primary" @click="handleSubmit">提交</tiny-button>
12
+ <tiny-button @click="clearFormValid">移除表单校验</tiny-button>
13
13
  </tiny-form-item>
14
14
  </tiny-form>
15
15
  </div>
@@ -8,8 +8,8 @@
8
8
  <tiny-input v-model="createData.user2"></tiny-input>
9
9
  </tiny-form-item>
10
10
  <tiny-form-item>
11
- <tiny-button type="success" @click="clearFormValid">移除表单校验</tiny-button>
12
11
  <tiny-button type="primary" @click="handleSubmit">提交</tiny-button>
12
+ <tiny-button @click="clearFormValid">移除表单校验</tiny-button>
13
13
  </tiny-form-item>
14
14
  </tiny-form>
15
15
  </div>
@@ -86,7 +86,7 @@ function getPopEditorOp() {
86
86
  {
87
87
  field: 'id',
88
88
  title: 'ID',
89
- width: 40
89
+ width: 60
90
90
  },
91
91
  {
92
92
  field: 'name',
@@ -89,7 +89,7 @@ export default {
89
89
  {
90
90
  field: 'id',
91
91
  title: 'ID',
92
- width: 40
92
+ width: 60
93
93
  },
94
94
  {
95
95
  field: 'name',
@@ -7,7 +7,7 @@
7
7
  <tiny-grid-column field="address" title="地址"></tiny-grid-column>
8
8
  <tiny-grid-column field="introduction" title="公司简介" show-overflow></tiny-grid-column>
9
9
  <template #empty>
10
- <span style="color: red">没有更多数据了!</span>
10
+ <span style="color: #ff8800">没有更多数据了!</span>
11
11
  </template>
12
12
  </tiny-grid>
13
13
  <br />
@@ -7,7 +7,7 @@
7
7
  <tiny-grid-column field="address" title="地址"></tiny-grid-column>
8
8
  <tiny-grid-column field="introduction" title="公司简介" show-overflow></tiny-grid-column>
9
9
  <template #empty>
10
- <span style="color: red">没有更多数据了!</span>
10
+ <span style="color: #ff8800">没有更多数据了!</span>
11
11
  </template>
12
12
  </tiny-grid>
13
13
  <br />
@@ -5,7 +5,6 @@
5
5
  ref="gridRef"
6
6
  :select-config="selectConfig"
7
7
  highlight-current-row
8
- border
9
8
  :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }"
10
9
  >
11
10
  <tiny-grid-column type="selection" width="60"></tiny-grid-column>
@@ -10,7 +10,7 @@ export default {
10
10
  <p>通过在 <code>grid</code> 标签上配置 <code>edit-config</code>。在 <code>grid-column</code> 列配置 <code>editor</code> 对象, <code>component</code> 渲染内置编辑组件, <code>events</code> 配置组件事件。</p>
11
11
  <div class="tip custom-block">
12
12
  <p class="custom-block-title">特别说明:</p>
13
- <p>内置编辑器只支持 <code>Input</code> 和 <code>Select</code> 组件,需要使用其他组件可参考自定义编辑器。</p>
13
+ <p>内置编辑器只支持 <code>Input</code> 和 <code>Select</code> 组件且均为浏览器原生组件并非TinyVue组件,需要使用其他组件可参考自定义编辑器。</p>
14
14
  </div>
15
15
  `,
16
16
  'en-US':
@@ -44,7 +44,7 @@ export default {
44
44
  {
45
45
  'demoId': 'editor-popeditor-in-grid-remote-search',
46
46
  'name': {
47
- 'zh-CN': 'Popeditor 弹窗编辑',
47
+ 'zh-CN': '弹窗编辑',
48
48
  'en-US': 'Edit the Popeditor pop-up window and configure remote search.'
49
49
  },
50
50
  'desc': {
@@ -2,6 +2,7 @@
2
2
  <div class="demo-hrapprover-class">
3
3
  <tiny-hrapprover
4
4
  v-model="value"
5
+ title="选择权签人"
5
6
  :approval-person="person"
6
7
  @update:approvalPerson="person = $event"
7
8
  ></tiny-hrapprover>
@@ -2,6 +2,7 @@
2
2
  <div class="demo-hrapprover-class">
3
3
  <tiny-hrapprover
4
4
  v-model="value"
5
+ title="选择权签人"
5
6
  :approval-person="person"
6
7
  @update:approvalPerson="person = $event"
7
8
  ></tiny-hrapprover>
@@ -4,6 +4,7 @@
4
4
  v-model="value"
5
5
  :approval-person="person"
6
6
  @update:approvalPerson="person = $event"
7
+ title="选择权签人"
7
8
  category="0506"
8
9
  ></tiny-hrapprover>
9
10
  </div>
@@ -3,6 +3,7 @@
3
3
  <tiny-hrapprover
4
4
  v-model="value"
5
5
  :approval-person="person"
6
+ title="选择权签人"
6
7
  @update:approvalPerson="person = $event"
7
8
  category="0506"
8
9
  ></tiny-hrapprover>
@@ -6,6 +6,7 @@
6
6
  @update:approvalPerson="person = $event"
7
7
  :fetch-hrapprover="getFetchHrapprover"
8
8
  :category="category"
9
+ title="选择权签人"
9
10
  ></tiny-hrapprover>
10
11
  </div>
11
12
  </template>
@@ -6,6 +6,7 @@
6
6
  @update:approvalPerson="person = $event"
7
7
  :fetch-hrapprover="getFetchHrapprover"
8
8
  :category="category"
9
+ title="选择权签人"
9
10
  ></tiny-hrapprover>
10
11
  </div>
11
12
  </template>
@@ -4,6 +4,7 @@
4
4
  <tiny-hrapprover
5
5
  :value="value"
6
6
  :approval-person="person"
7
+ title="选择权签人"
7
8
  @update:approvalPerson="person = $event"
8
9
  :disabled="disabled"
9
10
  ></tiny-hrapprover>
@@ -4,6 +4,7 @@
4
4
  <tiny-hrapprover
5
5
  :value="value"
6
6
  :approval-person="person"
7
+ title="选择权签人"
7
8
  @update:approvalPerson="person = $event"
8
9
  :disabled="disabled"
9
10
  ></tiny-hrapprover>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-docs",
3
- "version": "3.19.4",
3
+ "version": "3.19.6",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
6
  "@opentiny/vue-repl": "^1.1.2",
@@ -18,17 +18,17 @@
18
18
  "vue-router": "4.1.5",
19
19
  "@opentiny/vue": "~3.19.0",
20
20
  "@opentiny/vue-common": "~3.19.0",
21
- "@opentiny/vue-design-saas": "~3.19.0",
22
- "@opentiny/vue-directive": "~3.19.0",
23
- "@opentiny/vue-hooks": "~3.19.0",
21
+ "@opentiny/vue-icon-saas": "~3.19.0",
24
22
  "@opentiny/vue-design-aurora": "~3.19.0",
25
- "@opentiny/vue-icon": "~3.19.0",
26
23
  "@opentiny/vue-icon-multicolor": "~3.19.0",
27
- "@opentiny/vue-icon-saas": "~3.19.0",
28
- "@opentiny/vue-theme": "~3.19.4",
24
+ "@opentiny/vue-hooks": "~3.19.0",
25
+ "@opentiny/vue-design-saas": "~3.19.0",
26
+ "@opentiny/vue-icon": "~3.19.0",
27
+ "@opentiny/vue-directive": "~3.19.0",
28
+ "@opentiny/vue-theme": "~3.19.5",
29
29
  "@opentiny/vue-theme-mobile": "~3.19.0",
30
- "@opentiny/vue-theme-saas": "~3.19.0",
31
- "@opentiny/vue-vite-import": "~1.2.0"
30
+ "@opentiny/vue-vite-import": "~1.2.0",
31
+ "@opentiny/vue-theme-saas": "~3.19.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@playwright/test": "~1.42.0",
@@ -1,23 +1,18 @@
1
- <script setup>
1
+ <script setup lang="jsx">
2
2
  import { onMounted, reactive, nextTick } from 'vue'
3
3
  import { Repl, useStore, File } from '@opentiny/vue-repl'
4
4
  import '@opentiny/vue-repl/dist/style.css'
5
5
 
6
6
  import Editor from '@vue/repl/codemirror-editor'
7
- import {
8
- ButtonGroup as TinyButtonGroup,
9
- Select as TinySelect,
10
- Option as TinyOption,
11
- Switch as TinySwitch,
12
- Notify
13
- } from '@opentiny/vue'
7
+ import { TinyButtonGroup, TinyButton, TinySelect, TinyOption, TinySwitch, Notify } from '@opentiny/vue'
14
8
  import { staticDemoPath, getWebdocPath } from '@/views/components/cmp-config'
15
9
  import { fetchDemosFile } from '@/tools/utils'
16
10
  import logoUrl from './assets/opentiny-logo.svg?url'
17
11
  import GitHub from './icons/Github.vue'
18
12
  import Share from './icons/Share.vue'
19
13
 
20
- const VERSION = 'tiny-vue-version-3.16'
14
+ const VERSION = 'tiny-vue-version-3.19'
15
+ const NOTIFY_KEY = 'tiny-vue-playground-notify'
21
16
  const LAYOUT = 'playground-layout'
22
17
  const LAYOUT_REVERSE = 'playground-layout-reverse'
23
18
 
@@ -28,40 +23,57 @@ const isMobileFirst = tinyMode === 'mobile-first'
28
23
  const isSaas = tinyTheme === 'saas'
29
24
  const isPreview = searchObj.get('openMode') === 'preview' // 是否多端弹窗预览
30
25
 
31
- const versions = ['3.19', '3.18', '3.17', '3.16', '3.15', '3.14', '3.13', '3.12', '3.11', '3.10', '3.9', '3.8']
32
- const latestVersion = isPreview ? versions[0] : localStorage.getItem(VERSION) || versions[0]
26
+ const versions = ['3.19', '3.18', '3.17']
27
+ const getVersion = () => {
28
+ if (isPreview) {
29
+ return versions[0]
30
+ }
31
+ if (versions.includes(localStorage.getItem(VERSION))) {
32
+ localStorage.getItem(VERSION)
33
+ }
34
+ return versions[0]
35
+ }
36
+ const latestVersion = getVersion()
33
37
  const cdnHost = localStorage.getItem('setting-cdn')
34
38
 
35
39
  const versionDelimiter = cdnHost.includes('npmmirror') ? '/' : '@'
36
40
  const fileDelimiter = cdnHost.includes('npmmirror') ? 'files/' : ''
37
41
 
38
- const isOldVersion = (version) => {
39
- const minorVersion = version?.split('.')?.[1]
40
- return minorVersion && minorVersion < 16
41
- }
42
-
43
- // 3.16.0版本之前的runtime还没有抽离单独的包
44
- const getRuntime = (version) => {
45
- if (isOldVersion(version)) {
46
- return `${cdnHost}/@opentiny/vue${versionDelimiter}${version}/${fileDelimiter}runtime/`
42
+ let notify
43
+ const showNotify = () => {
44
+ if (localStorage.getItem(NOTIFY_KEY) !== 'true' && !notify) {
45
+ const muteNotify = () => {
46
+ notify.close()
47
+ localStorage.setItem(NOTIFY_KEY, true)
48
+ }
49
+ notify = Notify({
50
+ type: 'info',
51
+ title: '温馨提示:',
52
+ message: () => (
53
+ <div>
54
+ <div>演练场仅保留最新的三个版本可选。</div>
55
+ <div style="text-align: right;margin-top: 12px;">
56
+ <TinyButton onClick={muteNotify} type={'primary'}>
57
+ 不再提示
58
+ </TinyButton>
59
+ </div>
60
+ </div>
61
+ ),
62
+ duration: -1,
63
+ position: 'top-right',
64
+ verticalOffset: 200
65
+ })
47
66
  }
48
- return `${cdnHost}/@opentiny/vue-runtime${versionDelimiter}${version}/${fileDelimiter}dist3/`
49
67
  }
50
68
 
51
- // 3.16.0版本之前的runtime没有tiny-vue-pc.mjs文件
52
- const getPcRuntime = (version) => {
53
- if (isOldVersion(version)) {
54
- return `${getRuntime(version)}tiny-vue.mjs`
55
- }
56
- return `${getRuntime(version)}tiny-vue-pc.mjs`
57
- }
69
+ const getRuntime = (version) => `${cdnHost}/@opentiny/vue-runtime${versionDelimiter}${version}/${fileDelimiter}dist3/`
58
70
 
59
71
  const createImportMap = (version) => {
60
72
  const imports = {
61
73
  'vue': `${cdnHost}/vue${versionDelimiter}3.4.27/${fileDelimiter}dist/vue.runtime.esm-browser.js`,
62
74
  'echarts': `${cdnHost}/echarts${versionDelimiter}5.4.1/${fileDelimiter}dist/echarts.esm.js`,
63
75
  '@vue/compiler-sfc': `${cdnHost}/@vue/compiler-sfc${versionDelimiter}3.4.27/${fileDelimiter}dist/compiler-sfc.esm-browser.js`,
64
- '@opentiny/vue': getPcRuntime(version),
76
+ '@opentiny/vue': `${getRuntime(version)}tiny-vue-pc.mjs`,
65
77
  '@opentiny/vue-icon': `${getRuntime(version)}tiny-vue-icon.mjs`,
66
78
  '@opentiny/vue-locale': `${getRuntime(version)}tiny-vue-locale.mjs`,
67
79
  '@opentiny/vue-common': `${getRuntime(version)}tiny-vue-common.mjs`,
@@ -72,8 +84,9 @@ const createImportMap = (version) => {
72
84
  'sortablejs': `${cdnHost}/sortablejs${versionDelimiter}1.15.0/${fileDelimiter}modular/sortable.esm.js`
73
85
  }
74
86
  if (['aurora', 'saas'].includes(tinyTheme)) {
75
- imports[`@opentiny/vue-design-${tinyTheme}`] =
76
- `${cdnHost}/@opentiny/vue-design-${tinyTheme}${versionDelimiter}${version}/${fileDelimiter}index.js`
87
+ imports[
88
+ `@opentiny/vue-design-${tinyTheme}`
89
+ ] = `${cdnHost}/@opentiny/vue-design-${tinyTheme}${versionDelimiter}${version}/${fileDelimiter}index.js`
77
90
  }
78
91
  if (isSaas) {
79
92
  imports['@opentiny/vue-icon'] = `${getRuntime(version)}tiny-vue-icon-saas.mjs`
@@ -275,9 +288,9 @@ function share() {
275
288
 
276
289
  <template>
277
290
  <div class="header">
278
- <div class="title"><img class="logo" :src="logoUrl" /> <span>OpenTiny Vue 演练场</span></div>
291
+ <div class="title"><img class="logo" :src="logoUrl" /> <span class="mobile-hide">OpenTiny Vue 演练场</span></div>
279
292
  <div>
280
- <span class="ml20">
293
+ <span class="ml20 mobile-hide">
281
294
  布局方向:
282
295
  <tiny-button-group
283
296
  :data="state.layoutOptions"
@@ -285,13 +298,19 @@ function share() {
285
298
  @change="changeLayout"
286
299
  ></tiny-button-group>
287
300
  </span>
288
- <span class="ml20">
301
+ <span class="ml20 mobile-hide">
289
302
  布局反转:
290
303
  <tiny-switch v-model="state.layoutReverse" mini @change="changeReserve"></tiny-switch>
291
304
  </span>
292
305
  <span class="ml20">
293
- OpenTiny Vue 版本:
294
- <tiny-select v-model="state.selectVersion" @change="selectVersion" style="width: 150px" :disabled="isPreview">
306
+ <span class="mobile-hide">OpenTiny Vue 版本: </span>
307
+ <tiny-select
308
+ v-model="state.selectVersion"
309
+ style="width: 150px"
310
+ :disabled="isPreview"
311
+ @change="selectVersion"
312
+ @click="showNotify"
313
+ >
295
314
  <tiny-option v-for="item in state.versions" :key="item.value" :label="item.value" :value="item.value">
296
315
  </tiny-option>
297
316
  </tiny-select>
@@ -317,6 +336,12 @@ function share() {
317
336
  box-sizing: border-box;
318
337
  }
319
338
 
339
+ /** 小屏幕时隐藏 */
340
+ @media screen and (max-width: 640px) {
341
+ .mobile-hide {
342
+ display: none;
343
+ }
344
+ }
320
345
  #header {
321
346
  display: none;
322
347
  }
@@ -16,7 +16,7 @@
16
16
  </div>
17
17
  <span class="docs-header-spacer"></span>
18
18
  </header>
19
- <div class="docs-content">
19
+ <div class="docs-content" id="doc-layout-scoller">
20
20
  <div class="ti-fi-1 ti-rel cmp-container">
21
21
  <div class="flex-horizontal docs-content-main">
22
22
  <div class="docs-tabs-wrap">
@@ -241,7 +241,7 @@
241
241
  :is-affix="anchorAffix"
242
242
  type="dot"
243
243
  mask-class="custom-active-anchor"
244
- container-id="#doc-layout"
244
+ container-id="#doc-layout-scoller"
245
245
  @link-click="handleAnchorClick"
246
246
  >
247
247
  </tiny-anchor>
@@ -254,8 +254,8 @@
254
254
  {{ i18nByKey('doc-owner') }} : {{ currJson.owner }}
255
255
  </div>
256
256
  </div>
257
+ <div id="footer"></div>
257
258
  </div>
258
- <div id="footer"></div>
259
259
  </template>
260
260
 
261
261
  <script lang="jsx">
@@ -473,7 +473,7 @@ export default defineComponent({
473
473
  const scrollByHash = (hash) => {
474
474
  setTimeout(() => {
475
475
  if (!hash) {
476
- document.getElementById('doc-layout').scrollTo({
476
+ document.getElementById('doc-layout-scoller').scrollTo({
477
477
  top: 0,
478
478
  left: 0
479
479
  })
@@ -486,7 +486,7 @@ export default defineComponent({
486
486
  scrollTarget = document.querySelector(`#${hash}`)
487
487
  } catch (err) {}
488
488
  if (scrollTarget && !isRunningTest) {
489
- document.getElementById('doc-layout').scrollTo({
489
+ document.getElementById('doc-layout-scoller').scrollTo({
490
490
  top: scrollTarget.offsetTop,
491
491
  left: 0,
492
492
  behavior: 'smooth'
@@ -501,7 +501,7 @@ export default defineComponent({
501
501
  let hash = router.currentRoute.value.hash?.slice(1)
502
502
  if (hash !== 'API') {
503
503
  setTimeout(() => {
504
- document.getElementById('doc-layout').scrollTo({
504
+ document.getElementById('doc-layout-scoller').scrollTo({
505
505
  top: 0,
506
506
  left: 0,
507
507
  behavior: 'smooth'
@@ -622,18 +622,18 @@ export default defineComponent({
622
622
  }
623
623
 
624
624
  const onDocLayoutScroll = debounce(100, false, () => {
625
- const docLayout = document.getElementById('doc-layout')
625
+ const docLayout = document.getElementById('doc-layout-scoller')
626
626
  const { scrollTop, scrollHeight, clientHeight: layoutHeight } = docLayout
627
627
  const headerHeight = document.querySelector('.docs-header')?.clientHeight || 0
628
628
  const footerHeight = document.getElementById('footer')?.clientHeight || 0
629
629
  const anchorHeight = document.querySelector('#anchor')?.clientHeight || 0
630
- const remainHeight = scrollHeight - scrollTop - layoutHeight // doc-layout视口下隐藏的部分高度
630
+ const remainHeight = scrollHeight - scrollTop - layoutHeight // doc-layout-scoller视口下隐藏的部分高度
631
631
  state.anchorAffix = layoutHeight - headerHeight - (footerHeight - remainHeight) > anchorHeight
632
632
  })
633
633
 
634
634
  const setScrollListener = () => {
635
635
  nextTick(() => {
636
- const docLayout = document.getElementById('doc-layout')
636
+ const docLayout = document.getElementById('doc-layout-scoller')
637
637
  if (docLayout) {
638
638
  docLayout.addEventListener('scroll', onDocLayoutScroll)
639
639
  }
@@ -641,7 +641,7 @@ export default defineComponent({
641
641
  }
642
642
 
643
643
  const removeScrollListener = () => {
644
- const docLayout = document.getElementById('doc-layout')
644
+ const docLayout = document.getElementById('doc-layout-scoller')
645
645
  if (docLayout) {
646
646
  docLayout.removeEventListener('scroll', onDocLayoutScroll)
647
647
  }
@@ -809,14 +809,15 @@ export default defineComponent({
809
809
  }
810
810
 
811
811
  .docs-content {
812
- margin: 16px 0 120px;
812
+ flex: 1;
813
+ overflow: hidden auto;
814
+ padding: 16px 0 0;
813
815
  transition: all ease-in-out 0.3s;
814
816
 
815
817
  .docs-tabs-wrap {
816
818
  flex: 1;
817
819
  display: flex;
818
820
  justify-content: center;
819
- min-width: 680px;
820
821
  padding: 0 40px;
821
822
  }
822
823
 
@@ -837,7 +838,6 @@ export default defineComponent({
837
838
 
838
839
  :deep(> .tiny-tabs__header) {
839
840
  position: sticky;
840
- top: 90px;
841
841
  z-index: var(--docs-tabs-header-zindex);
842
842
  background-color: #fff;
843
843