-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
94 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Driver from 'driver.js'; | ||
import 'driver.js/dist/driver.min.css'; | ||
|
||
export function useStepsDriver(steps: Driver.Step[]) { | ||
const driver = new Driver({ | ||
doneBtnText: '完成', // Text on the final button | ||
closeBtnText: '关闭', // Text on the close button for this step | ||
stageBackground: 'rgba(255, 255, 255,0.4)', // Background color for the staged behind highlighted element | ||
nextBtnText: '下一步', // Next button text for this step | ||
prevBtnText: '上一步', // Previous button text for this step | ||
}); | ||
|
||
function startDriver(e: Event) { | ||
e.stopPropagation(); | ||
driver.defineSteps(steps); | ||
driver.start(); | ||
} | ||
return { startDriver }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,9 @@ export default { | |
path: '/welcome', | ||
name: '欢迎页', | ||
}, | ||
{ | ||
path: '/driver', | ||
name: '引导页', | ||
}, | ||
], | ||
} as NormMenuItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script lang="tsx"> | ||
import { defineComponent } from 'compatible-vue'; | ||
import { Button } from 'ant-design-vue'; | ||
import { useStepsDriver } from '@/hooks/core/useDriver'; | ||
export default defineComponent({ | ||
name: 'DriverIndex', | ||
setup() { | ||
const { startDriver } = useStepsDriver([ | ||
{ | ||
element: '#elem-driver-trigger', | ||
popover: { | ||
title: '收起菜单栏', | ||
description: '', | ||
}, | ||
}, | ||
{ | ||
element: '#elem-driver-action-refresh', | ||
popover: { | ||
title: '刷新页面', | ||
description: '', | ||
}, | ||
}, | ||
{ | ||
element: '#elem-driver-setting-btn', | ||
popover: { | ||
title: '更改系统配置', | ||
description: '', | ||
position: 'left', | ||
}, | ||
}, | ||
]); | ||
return () => ( | ||
<div> | ||
<div id="start-driver" class="m-4"> | ||
本demo是基于 | ||
<a href="https://github.com/kamranahmedse/driver.js" target="_blank"> | ||
driver.js. | ||
</a> | ||
</div> | ||
<Button onClick={startDriver} class="m-4"> | ||
开始引导 | ||
</Button> | ||
</div> | ||
); | ||
}, | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters