Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add guide component #1540

Merged
merged 55 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9d1bc41
feat(guide): init
zhangpaopao0609 Aug 19, 2022
6779ce4
feat(guide): init guide src and example
zhangpaopao0609 Aug 19, 2022
8defb60
feat(guide): guide basic content
zhangpaopao0609 Aug 21, 2022
cbd49e4
feat(guide): event params and current
zhangpaopao0609 Aug 21, 2022
0423c6f
feat(guide): action button props
zhangpaopao0609 Aug 21, 2022
401739d
feat(guide): mask props
zhangpaopao0609 Aug 21, 2022
4407051
feat(guide): counter slots
zhangpaopao0609 Aug 21, 2022
1ec36e8
feat(guide): guide dialog mode
zhangpaopao0609 Aug 22, 2022
ad59e58
feat(guide): guide dialog
zhangpaopao0609 Aug 22, 2022
6547d2b
feat(guide): guide dialog nomask
zhangpaopao0609 Aug 22, 2022
6dfe5c6
feat(guide): popup step content
zhangpaopao0609 Aug 22, 2022
4e6d41a
feat(guide): highlighPadding and currentCrossProps type
zhangpaopao0609 Aug 23, 2022
ab93cf4
feat(guide): mask change to showOverlay
zhangpaopao0609 Aug 26, 2022
d4c1b42
feat(guide): support highlightContent
zhangpaopao0609 Aug 26, 2022
b16b26d
feat(guide): support zIndex
zhangpaopao0609 Aug 26, 2022
caf1643
feat(guide): unified counter style
zhangpaopao0609 Aug 27, 2022
03126bb
docs(guide): {content: 'xxx', theme:'xxx'}
zhangpaopao0609 Aug 27, 2022
ef448a6
feat(guide): demos
zhangpaopao0609 Aug 27, 2022
1e3f152
feat(guide): optimization
zhangpaopao0609 Aug 29, 2022
1ab5bd7
feat(guide): add custom-popup demo
zhangpaopao0609 Aug 29, 2022
9424f73
chore(guide): type
zhangpaopao0609 Aug 29, 2022
f8035db
feat(guide): refact content and highlighContent
zhangpaopao0609 Aug 30, 2022
8741ea4
fix(guide): destory dialog wrapper
zhangpaopao0609 Aug 30, 2022
58e1758
docs(guide): use justify center
zhangpaopao0609 Aug 30, 2022
fd637c7
test: test init
zhangpaopao0609 Aug 30, 2022
bee50c1
chore(guide): update common commit
zhangpaopao0609 Aug 30, 2022
8ffe69a
Merge branch 'develop' into feature/guide
zhangpaopao0609 Aug 30, 2022
540a285
fix(guide): spell error
zhangpaopao0609 Aug 30, 2022
a191bff
test: update snap
zhangpaopao0609 Aug 30, 2022
16ffeed
chore(guide): spell error
zhangpaopao0609 Aug 30, 2022
50d71e7
fix(guide): dialog padding should invalid
zhangpaopao0609 Aug 30, 2022
188e0e7
fix(guide): highlightContent only in popup
zhangpaopao0609 Aug 30, 2022
41d89c8
feat(guide): change props name and steps desc change to body
zhangpaopao0609 Aug 30, 2022
e1a70e5
Merge branch 'develop' into feature/guide
zhangpaopao0609 Aug 31, 2022
f4280f2
chore(guide): merge develop and update
zhangpaopao0609 Aug 31, 2022
32faf99
chore(guide): update common
zhangpaopao0609 Aug 31, 2022
b24dd80
feat(guide): prev button use default theme and add intro
zhangpaopao0609 Sep 2, 2022
1dbcd6d
revert(guide): revert vscode/settings
zhangpaopao0609 Sep 2, 2022
7686ac8
chore(_common): update _common
zhangpaopao0609 Sep 2, 2022
776a5c9
chore(_common): update _common
zhangpaopao0609 Sep 2, 2022
7d976c4
feat(guide): vmp
zhangpaopao0609 Sep 2, 2022
1330ab7
chore(guide): update snap
zhangpaopao0609 Sep 2, 2022
1f7bb46
feat(guide): some optimization and some change
zhangpaopao0609 Sep 5, 2022
4741057
chore: merge develop
zhangpaopao0609 Sep 5, 2022
5c340b3
fix(guide): spell error
zhangpaopao0609 Sep 5, 2022
4e554f4
feat(guide): guide css use token
zhangpaopao0609 Sep 5, 2022
bd1d0a1
refactor(guide): removeElm change to oneline
zhangpaopao0609 Sep 6, 2022
dbaaf1f
feat(guide): scrollTo use common utils
zhangpaopao0609 Sep 6, 2022
7494744
docs(guide): example add scoped and css use token
zhangpaopao0609 Sep 6, 2022
5af3c77
chore(_common): update _common
zhangpaopao0609 Sep 6, 2022
e5ed7e1
chore: merge branch 'develop' into feature/guide
zhangpaopao0609 Sep 7, 2022
7857b17
chore(guide): update snap
zhangpaopao0609 Sep 7, 2022
c5ad590
feat(_common): add guide logo
zhangpaopao0609 Sep 13, 2022
4a91d5a
feat(guide): move shared utils to dom/utils
zhangpaopao0609 Sep 14, 2022
ffb90c1
chore: merge branch 'develop' into feature/guide
zhangpaopao0609 Sep 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions site/site.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@ export default {
path: '/vue-next/components/drawer',
component: () => import('tdesign-vue-next/drawer/drawer.md'),
},
{
title: 'Guide 引导',
name: 'guide',
path: '/vue-next/components/guide',
component: () => import('tdesign-vue-next/guide/guide.md'),
},
{
title: 'Message 全局提示',
name: 'message',
Expand Down
1 change: 1 addition & 0 deletions src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export * from './rate';
export * from './alert';
export * from './dialog';
export * from './drawer';
export * from './guide';
export * from './loading';
export * from './message';
export * from './notification';
Expand Down
138 changes: 138 additions & 0 deletions src/guide/_example/base.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<template>
<t-row justify="center">
<t-button @click="handleClick">新手引导</t-button>
<t-drawer v-model:visible="visible" header="演示新手引导" size="60%" :show-overlay="false" destroy-on-close>
<template #footer>
<t-button @click="visible = false"> 关闭抽屉 </t-button>
</template>
<div class="guide-container">
<div class="main-title">
<div class="title-major">Guide 用户引导</div>
<div class="title-sub">按钮用于开启一个闭环的操作任务,如“删除”对象、“购买”商品等。</div>
</div>
<div class="field label-field">
<div class="label">Label</div>
<t-input placeholder="请输入内容" />
</div>
<div class="field">
<div class="label">Label</div>
<t-input placeholder="请输入内容" />
</div>
<t-row class="action">
<t-button>确定</t-button>
<t-button theme="default" variant="base">取消</t-button>
</t-row>
</div>

<t-guide
v-model="current"
:steps="steps"
@change="handleChange"
@prev-step-click="handlePrevStepClick"
@next-step-click="handleNextStepClick"
@finish="handleFinish"
@skip="handleSkip"
/>
</t-drawer>
</t-row>
</template>

<script setup>
import { ref } from 'vue';

const visible = ref(false);
const current = ref(-1);

const steps = [
{
element: '.main-title',
title: '新手引导标题',
body: '新手引导的说明文案',
placement: 'bottom-right',
},
{
element: '.label-field',
title: '新手引导标题',
body: '新手引导的说明文案',
placement: 'bottom',
},
{
element: '.action',
title: '新手引导标题',
body: '新手引导的说明文案',
placement: 'right',
},
];

const handleClick = () => {
visible.value = true;
setTimeout(() => {
current.value = 0;
}, 800);
};

const handleChange = (current, { e, total }) => {
console.log(current, e, total);
};

const handlePrevStepClick = ({ e, prev, current, total }) => {
console.log(e, prev, current, total);
};

const handleNextStepClick = ({ e, next, current, total }) => {
console.log(e, next, current, total);
};

const handleFinish = ({ e, current, total }) => {
visible.value = false;
console.log(e, current, total);
};

const handleSkip = ({ e, current, total }) => {
visible.value = false;
console.log(e, current, total);
};
</script>

<style>
.guide-container {
max-width: 600px;
padding: 40px;
}

.title-major {
color: rgba(0, 0, 0, 0.9);
font-size: 36px;
font-weight: 700;
line-height: 44px;
}

.title-sub {
margin-top: 8px;
color: rgba(0, 0, 0, 0.6);
font-size: 14px;
font-weight: 400;
line-height: 22px;
}

.field {
margin-top: 50px;
}

.label {
margin-bottom: 8px;
color: rgba(0, 0, 0, 0.9);
font-size: 14px;
font-weight: 400;
line-height: 22px;
}

.action {
display: inline-flex;
margin-top: 50px;
}

.action button {
margin-right: 10px;
}
</style>
142 changes: 142 additions & 0 deletions src/guide/_example/custom-popup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<template>
<t-row justify="center">
<t-button @click="handleClick">新手引导</t-button>
<t-drawer v-model:visible="visible" header="演示新手引导" size="60%" :show-overlay="false" destroy-on-close>
<template #footer>
<t-button @click="visible = false"> 关闭抽屉 </t-button>
</template>
<div class="guide-container">
<div class="main-title">
<div class="title-major">Guide 用户引导</div>
<div class="title-sub">按钮用于开启一个闭环的操作任务,如“删除”对象、“购买”商品等。</div>
</div>
<div class="field label-field-1">
<div class="label">Label</div>
<t-input placeholder="请输入内容" />
</div>
<div class="field label-field-2">
<div class="label">Label</div>
<t-input placeholder="请输入内容" />
</div>
<t-row class="action">
<t-button>确定</t-button>
<t-button theme="default" variant="base">取消</t-button>
</t-row>
</div>

<t-guide
v-model="current"
:steps="steps"
@change="handleChange"
@prev-step-click="handlePrevStepClick"
@next-step-click="handleNextStepClick"
@finish="handleFinish"
@skip="handleSkip"
/>
</t-drawer>
</t-row>
</template>

<script setup>
import { ref } from 'vue';
import MyPopup from './my-popup.vue';

const visible = ref(false);
const current = ref(-1);

const steps = [
{
element: '.main-title',
title: '新手引导标题',
description: '新手引导的说明文案',
placement: 'bottom-right',
content: MyPopup,
},
{
element: '.label-field-1',
title: '新手引导标题',
description: '新手引导的说明文案',
placement: 'bottom',
content: MyPopup,
},
{
element: '.label-field-2',
title: '新手引导标题',
description: '新手引导的说明文案',
placement: 'bottom-left',
content: MyPopup,
},
];

const handleClick = () => {
visible.value = true;
setTimeout(() => {
current.value = 0;
}, 800);
};

const handleChange = (current, { e, total }) => {
console.log(current, e, total);
};

const handlePrevStepClick = ({ e, prev, current, total }) => {
console.log(e, prev, current, total);
};

const handleNextStepClick = ({ e, next, current, total }) => {
console.log(e, next, current, total);
};

const handleFinish = ({ e, current, total }) => {
visible.value = false;
console.log(e, current, total);
};

const handleSkip = ({ e, current, total }) => {
visible.value = false;
console.log(e, current, total);
};
</script>

<style>
.guide-container {
max-width: 600px;
padding: 40px;
}

.title-major {
color: rgba(0, 0, 0, 0.9);
font-size: 36px;
font-weight: 700;
line-height: 44px;
}

.title-sub {
margin-top: 8px;
color: rgba(0, 0, 0, 0.6);
font-size: 14px;
font-weight: 400;
line-height: 22px;
}

.field {
margin-top: 50px;
}

.label {
margin-bottom: 8px;
color: rgba(0, 0, 0, 0.9);
font-size: 14px;
font-weight: 400;
line-height: 22px;
}

.action {
display: inline-flex;
margin-top: 50px;
}

.action button {
margin-right: 10px;
}
</style>
23 changes: 23 additions & 0 deletions src/guide/_example/dialog-body.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<div class="dialog-body">
<img class="dialog-img" src="https://tdesign.gtimg.com/demo/demo-image-1.png" alt="demo" />
<p>此处显示本页引导的说明文案,可按需要撰写,如内容过多可折行显示。图文也可按需自由设计。</p>
</div>
</template>

<script setup></script>

<style>
.dialog-img {
width: 100%;
}

p {
margin-top: 16px;
color: rgba(0, 0, 0, 0.6);
font-size: 14px;
font-weight: 400;
text-align: left;
line-height: 22px;
}
</style>
Loading