2017-08-17 22:00:37 +05:30
|
|
|
<script>
|
2018-12-13 13:39:08 +05:30
|
|
|
import Prism from '../../lib/highlight';
|
|
|
|
import Prompt from '../prompt.vue';
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
prompt: Prompt,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
count: {
|
|
|
|
type: Number,
|
|
|
|
required: false,
|
|
|
|
default: 0,
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
codeCssClass: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
rawCode: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
code() {
|
|
|
|
return this.rawCode;
|
|
|
|
},
|
|
|
|
promptType() {
|
|
|
|
const type = this.type.split('put')[0];
|
|
|
|
|
|
|
|
return type.charAt(0).toUpperCase() + type.slice(1);
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
Prism.highlightElement(this.$refs.code);
|
|
|
|
},
|
|
|
|
};
|
2017-08-17 22:00:37 +05:30
|
|
|
</script>
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
<template>
|
|
|
|
<div :class="type">
|
2018-12-23 12:14:25 +05:30
|
|
|
<prompt :type="promptType" :count="count" />
|
|
|
|
<pre ref="code" :class="codeCssClass" class="language-python" v-text="code"></pre>
|
2018-03-17 18:26:18 +05:30
|
|
|
</div>
|
|
|
|
</template>
|