Skip to content

Commit

Permalink
fix: new sfc file template
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Nov 27, 2023
1 parent c46b5e2 commit 79643d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { OutputModes } from './output/types'
import type { editor } from 'monaco-editor-core'
import welcomeCode from './template/welcome.vue?raw'
import newFileCode from './template/new-file.vue?raw'
import newSFCCode from './template/new-sfc.vue?raw'

const defaultMainFile = 'src/App.vue'

Expand Down Expand Up @@ -243,7 +243,10 @@ export class ReplStore implements Store {
addFile(fileOrFilename: string | File): void {
const file =
typeof fileOrFilename === 'string'
? new File(fileOrFilename, newFileCode)
? new File(
fileOrFilename,
fileOrFilename.endsWith('.vue') ? newSFCCode : ''
)
: fileOrFilename
this.state.files[file.filename] = file
if (!file.hidden) this.setActive(file.filename)
Expand Down
File renamed without changes.

0 comments on commit 79643d7

Please sign in to comment.