Skip to content

Commit d4773a4

Browse files
committed
fix reversed title bug
1 parent b7caa6f commit d4773a4

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/components/pages/SettingsPage.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
<Wrapper>
33
<Header>
44
<span
5+
ref="titleRef"
56
contenteditable="true"
67
@input="onTitleInput"
78
placeholder="Enter a project name"
89
:class="{ title: true, empty: !content || content.trim().length === 0 }"
9-
>{{ content }}</span>
10+
/>
1011
</Header>
1112
<main>
1213
<Settings v-if="project != null" />
@@ -15,7 +16,7 @@
1516
</Wrapper>
1617
</template>
1718
<script setup>
18-
import { ref, watch } from 'vue';
19+
import { ref, watch, onMounted } from 'vue';
1920
2021
import Footer from '@/components/layout/Footer.vue';
2122
import Header from '@/components/layout/Header.vue';
@@ -44,6 +45,13 @@ if (props.files !== null) {
4445
}
4546
4647
const content = ref(props.project.name);
48+
const titleRef = ref(null);
49+
50+
onMounted(() => {
51+
if (titleRef.value) {
52+
titleRef.value.textContent = content.value || '';
53+
}
54+
});
4755
4856
const onTitleInput = (event) => {
4957
content.value = event.currentTarget.textContent;

vite.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default defineConfig({
1212
}
1313
},
1414
build: {
15+
target: 'es2015',
1516
lib: {
1617
entry: path.resolve(__dirname, 'src/components/index.js'),
1718
name: 'nwl-components',

0 commit comments

Comments
 (0)