10000 feat: add showOpenSource prop · vuejs/repl@ca11a62 · GitHub
[go: up one dir, main page]

Skip to content

Commit ca11a62

Browse files
committed
feat: add showOpenSource prop
1 parent 3cc5a7f commit ca11a62

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/Repl.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface Props {
1818
store?: Store
1919
autoResize?: boolean
2020
showCompileOutput?: boolean
21+
showOpenSource?: boolean
2122
showImportMap?: boolean
2223
showTsConfig?: boolean
2324
clearConsole?: boolean
@@ -53,6 +54,7 @@ const props = withDefaults(defineProps<Props>(), {
5354
store: () => useStore(),
5455
autoResize: true,
5556
showCompileOutput: true,
57+
showOpenSource:false,
5658
showImportMap: true,
5759
showTsConfig: true,
5860
clearConsole: true,
@@ -105,6 +107,7 @@ defineExpose({ reload })
105107
ref="output"
106108
:editor-component="editor"
107109
:show-compile-output="props.showCompileOutput"
110+
:show-open-source="props.showOpenSource"
108111
:ssr="!!props.ssr"
109112
/>
110113
</template>

src/output/Output.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
const props = defineProps<{
1111
editorComponent: EditorComponentType
1212
showCompileOutput?: boolean
13-
ssr: boolean
13+
ssr: boolean,
14+
showOpenSource?: boolean
1415
}>()
1516
1617
const { store } = inject(injectKeyProps)!
@@ -34,7 +35,7 @@ const mode = computed<OutputModes>({
3435
})
3536
3637
const showSourceMap = computed(() => {
37-
return mode.value === 'js' || mode.value === 'ssr'
38+
return props.showOpenSource && mode.value === 'js' || mode.value === 'ssr'
3839
})
3940
4041
function openSourceMap() {

test/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const App = {
5858
theme: theme.value,
5959
previewTheme: previewTheme.value,
6060
editor: MonacoEditor,
61+
showOpenSource: true,
6162
// layout: 'vertical',
6263
ssr: true,
6364
sfcOptions: {

0 commit comments

Comments
 (0)
0