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' ;
2122import { DownOutlined } from ' @fesjs/fes-design/icon' ;
2223
23- // import playground from './playground';
24+ import playground from ' ./playground' ;
2425import codes from ' ./demoCode.json' ;
2526
2627const props = defineProps ({
@@ -38,20 +39,32 @@ watch(
3839);
3940
4041const visibleCode = ref (false );
41- // const openPlayground = () => {
42- // playground(props.code);
43- // };
42+ const openPlayground = () => {
43+ playground (props .code );
44+ };
4445
4546const 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 {
0 commit comments