4141 </div >
4242</template >
4343
44- <style lang="less">
45- .demo-block {
46- border : solid 1px #ebebeb ;
47- border-radius : 3px ;
48- transition : 0.2s ;
49- margin-top : 15px ;
50- margin-bottom : 15px ;
51- & .hover {
52- box-shadow : 0 0 8px 0 rgba (232 , 237 , 250 , 0.6 ),
53- 0 2px 4px 0 rgba (232 , 237 , 250 , 0.5 );
54- }
55- code {
56- font-family : Menlo, Monaco, Consolas, Courier , monospace ;
57- }
58- .demo-button {
59- float : right ;
60- }
61- .demo-content {
62- padding : 24px ;
63- }
64- .meta {
65- background-color : #282c34 ;
66- border : solid 1px #ebebeb ;
67- border-radius : 3px ;
68- overflow : hidden ;
69- height : 0 ;
70- transition : height 0.2s ;
71- }
72- .description {
73- padding : 20px ;
74- box-sizing : border-box ;
75- border : solid 1px #ebebeb ;
76- border-radius : 3px ;
77- font-size : 14px ;
78- line-height : 22px ;
79- color : #666 ;
80- word-break : break-word ;
81- margin : 10px ;
82- background-color : #fafafa ;
83- }
84- .code-content {
85- pre [class*= " language-" ] {
86- padding : 16px ;
87- margin : 8px 0 ;
88- }
89- }
90- .demo-block-control {
91- border-top : solid 1px #eaeefb ;
92- height : 44px ;
93- box-sizing : border-box ;
94- background-color : #fafafa ;
95- border-bottom-left-radius : 4px ;
96- border-bottom-right-radius : 4px ;
97- text-align : center ;
98- margin-top : -1px ;
99- color : #d3dce6 ;
100- cursor : pointer ;
101- position : relative ;
102-
103- & .is-fixed {
104- position : fixed ;
105- bottom : 0 ;
106- width : 660px ;
107- z-index : 999 ;
108- }
109-
110- .icon {
111- font-family : element- icons !important ;
112- font-style : normal ;
113- font-weight : 400 ;
114- font-variant : normal ;
115- text-transform : none ;
116- line-height : 1 ;
117- vertical-align : baseline ;
118- display : inline-block ;
119- -webkit-font-smoothing : antialiased ;
120- }
121-
122- .caret-top {
123- & ::before {
124- content : " " ;
125- position : absolute ;
126- right : 50% ;
127- width : 0 ;
128- height : 0 ;
129- border-bottom : 6px solid #ccc ;
130- border-right : 6px solid transparent ;
131- border-left : 6px solid transparent ;
132- }
133- }
134-
135- .caret-bottom {
136- & ::before {
137- content : " " ;
138- position : absolute ;
139- right : 50% ;
140- width : 0 ;
141- height : 0 ;
142- border-top : 6px solid #ccc ;
143- border-right : 6px solid transparent ;
144- border-left : 6px solid transparent ;
145- }
146- }
147-
148- i {
149- font-size : 16px ;
150- line-height : 44px ;
151- transition : 0.3s ;
152- & .hovering {
153- transform : translateX (-40px );
154- }
155- }
156-
157- > span {
158- position : absolute ;
159- transform : translateX (-30px );
160- font-size : 14px ;
161- line-height : 44px ;
162- transition : 0.3s ;
163- display : inline-block ;
164- }
165-
166- .copy-action {
167- right : 0px ;
168- color : #409eff ;
169- }
170-
171- & .copying {
172- transform : translateX (-44px );
173- }
174-
175- .copy-action-success {
176- color : #f5222d ;
177- }
178-
179- & :hover {
180- color : #409eff ;
181- background-color : #f9fafc ;
182- }
183- & .text-slide-enter ,
184- & .text-slide-leave-active {
185- opacity : 0 ;
186- transform : translateX (10px );
187- }
188-
189- & .bounce-enter-active {
190- animation : bounce- in 0.5s ;
191- }
192-
193- @keyframes bounce- in {
194- 0% {
195- transform : scale (0 );
196- }
197- 50% {
198- transform : scale (1.5 );
199- }
200- 100% {
201- transform : scale (1 );
202- }
203- }
204-
205- .control-button {
206- line-height : 26px ;
207- position : absolute ;
208- top : 0 ;
209- right : 0 ;
210- font-size : 14px ;
211- padding-left : 5px ;
212- padding-right : 25px ;
213- }
214- }
215- }
216- </style >
217-
21844<script type="text/babel">
219- import compoLang from ' ./i18n/lang.json' ;
45+ import ' ./style/index.less'
46+ import defaultLang from ' ./i18n/default_lang.json' ;
22047export default {
22148 data () {
22249 return {
@@ -228,9 +55,20 @@ export default {
22855 scrollParent: null
22956 };
23057 },
58+ props: {
59+ options: {
60+ type: Object ,
61+ default : () => {
62+ return {}
63+ }
64+ }
65+ },
23166 computed: {
67+ compoLang () {
68+ return this .options .locales || defaultLang
69+ },
23270 langConfig () {
233- return compoLang .filter (config => config .lang === this .$lang )[0 ][' demo-block' ];
71+ return this . compoLang .filter (config => config .lang === this .$lang )[0 ][' demo-block' ];
23472 },
23573 blockClass () {
23674 return ` demo-${ this .$lang } demo-${ this .$router .currentRoute .path
0 commit comments