Skip to content

Commit 205e820

Browse files
authored
Merge pull request #37 from mayinrain/master
upd: add playground
2 parents da74360 + 8513a4f commit 205e820

File tree

10 files changed

+43
-20
lines changed

10 files changed

+43
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_modules
44
.DS_Store
55
packages/traction-widget/node_modules
66
packages/traction-widget/es
7+
types
78
es
89
packages/traction-widget/dist
910
dist

docs/.vitepress/components/BNavBar/use.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const openDrawer = () => {
4444
showDrawer.value = true;
4545
};
4646
</script>
47-
<style lang='less' scoped>
47+
<style scoped>
4848
.eg-page {
4949
display: grid;
5050
padding: 16px 24px;

docs/.vitepress/components/BNavHeader/use.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const handleBack = () => {
1616
FMessage.info('自定义返回逻辑');
1717
};
1818
</script>
19-
<style lang='less' scoped>
19+
<style scoped>
2020
.eg-page {
2121
padding: 24px;
2222
background: #fff;

docs/.vitepress/components/BTableHeaderConfig/use.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<FTableColumn prop="title" label="标题" :visible="checkTColShow('title')"></FTableColumn>
77
<FTableColumn prop="content" label="内容" :visible="checkTColShow('content')"></FTableColumn>
88
<FTableColumn prop="action" label="操作" v-slot="{ row }" :visible="checkTColShow('action')">
9-
<a href="javascript:;" @click="viewContent(row)">查看</a>
9+
<a class="action-btn" href="javascript:;" @click="viewContent(row)">查看</a>
1010
</FTableColumn>
1111
</FTable>
1212
</div>
@@ -40,3 +40,11 @@ const viewContent = (row: {
4040
});
4141
};
4242
</script>
43+
<style>
44+
.action-btn {
45+
font-weight: 500;
46+
color: #10b981;
47+
text-decoration: none;
48+
transition: color 0.25s;
49+
}
50+
</style>

docs/.vitepress/components/BTagSelector/multi.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const handleChange = (val: any) => {
6161
console.log(val);
6262
};
6363
</script>
64-
<style scoped lang="less">
64+
<style scoped>
6565
.title-text {
6666
font-family: PingFangSC-Medium;
6767
font-size: 14px;

docs/.vitepress/components/BTagSelector/noheader.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const handleChange = (val: any) => {
1313
console.log(val);
1414
};
1515
</script>
16-
<style scoped lang="less">
16+
<style scoped>
1717
.title-text {
1818
font-family: PingFangSC-Medium;
1919
font-size: 14px;

docs/.vitepress/components/BTagSelector/single.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const handleClear = ()=>{
2020
console.log('clear all')
2121
}
2222
</script>
23-
<style scoped lang="less">
23+
<style scoped>
2424
.title-text {
2525
font-family: PingFangSC-Medium;
2626
font-size: 14px;

docs/.vitepress/custom/components/componentDoc.vue

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<template>
22
<div class="component-doc">
3+
4+
<span class="play" @click="openPlayground">Play</span>
35
<div class="component-doc-content">
46
<slot></slot>
57
</div>
68
<div :class="['component-doc-code', visibleCode && 'visible-code']" v-html="code"></div>
79
<div class="component-doc-header" @click="toggleCode">
8-
<!-- span class="play" @click="openPlayground">play</span-->
910
<!-- <LeftOutlined :class="['show-code-btn', visibleCode && 'active']" @click="toggleCode" /> -->
1011
{{visibleCode ? '收起代码' : '查看代码'}}
1112
<DownOutlined :class="['show-code-btn', visibleCode && 'active']" />
@@ -20,7 +21,7 @@ import {
2021
} from 'vue';
2122
import { DownOutlined } from '@fesjs/fes-design/icon';
2223
23-
// import playground from './playground';
24+
import playground from './playground';
2425
import codes from './demoCode.json';
2526
2627
const props = defineProps({
@@ -38,20 +39,32 @@ watch(
3839
);
3940
4041
const visibleCode = ref(false);
41-
// const openPlayground = () => {
42-
// playground(props.code);
43-
// };
42+
const openPlayground = () => {
43+
playground(props.code);
44+
};
4445
4546
const toggleCode = () => {
4647
visibleCode.value = !visibleCode.value;
4748
};
4849
</script>
4950
<style lang="less" scoped>
51+
.play {
52+
position: absolute;
53+
right: 16px;
54+
top: 12px;
55+
cursor: pointer;
56+
&:hover {
57+
color: #108981;
58+
}
59+
}
5060
.component-doc {
5161
margin-top: 16px;
5262
border: 1px solid #cfd0d3;
5363
border-radius: 4px;
54-
64+
position: relative;
65+
.component-doc-content {
66+
padding-top: 48px;
67+
}
5568
&-header {
5669
height: 48px;
5770
display: flex;
@@ -72,11 +85,6 @@ const toggleCode = () => {
7285
transform: rotateZ(-180deg);
7386
}
7487
}
75-
76-
.play {
77-
margin-right: 20px;
78-
cursor: pointer;
79-
}
8088
}
8189
8290
&-content {

docs/.vitepress/custom/components/exampleRepl.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ const fesDesignSetup = `
4545
link.rel = 'stylesheet'
4646
link.href = 'https://npm.elemecdn.com/@fesjs/fes-design@latest/dist/fes-design.min.css';
4747
document.head.appendChild(link)
48+
const twcsslink = document.createElement('link')
49+
twcsslink.rel = 'stylesheet'
50+
twcsslink.href = 'https://cdn.jsdelivr.net/npm/@fesjs/traction-widget/dist/traction-widget.min.css';
51+
document.head.appendChild(twcsslink)
4852
}
4953
5054
export function setupFesDesign() {
@@ -59,6 +63,7 @@ const fesDesignSetup = `
5963
`;
6064
6165
function resolveSFCExample (demo) {
66+
6267
const files = {
6368
[mainFile]: data.app,
6469
'space.vue': data.space,
@@ -67,7 +72,8 @@ function resolveSFCExample (demo) {
6772
'import-map.json': JSON.stringify({
6873
imports: {
6974
'@fesjs/fes-design': 'https://npm.elemecdn.com/@fesjs/fes-design@latest/dist/fes-design.esm-browser.js',
70-
'@fesjs/fes-design/icon': 'https://npm.elemecdn.com/@fesjs/fes-design@latest/dist/fes-design.icon-browser.js'
75+
'@fesjs/fes-design/icon': 'https://npm.elemecdn.com/@fesjs/fes-design@latest/dist/fes-design.icon-browser.js',
76+
'@fesjs/traction-widget': 'https://cdn.jsdelivr.net/npm/@fesjs/traction-widget/dist/traction-widget.esm-browser.js'
7177
}
7278
})
7379
};
@@ -90,7 +96,7 @@ defineExpose({
9096
handleShow
9197
});
9298
93-
watch(props.codeName, () => {
99+
watch(() => props.codeName, () => {
94100
updateExample(props.codeName);
95101
}, {
96102
immediate: true

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.8.11",
44
"description": "集合大型中台项目使用到的通用组件和工具函数",
55
"scripts": {
6-
"docs:dev": "npm run build && vitepress dev docs",
6+
"docs:dev": "npm run build && node scripts/generate-doc.js && vitepress dev docs",
77
"docs:build": "npm run build && node scripts/generate-doc.js && vitepress build docs",
88
"docsBuild": "npm run build && node scripts/generate-doc.js && vitepress build docs",
99
"prepare": "husky install",

0 commit comments

Comments
 (0)