Skip to content

Commit 0809319

Browse files
committed
htmldiretive
1 parent 626b1a8 commit 0809319

File tree

5 files changed

+32
-8
lines changed

5 files changed

+32
-8
lines changed

Diff for: src/App.vue

+9-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ import RouterButton from "@/components/RouterButton.vue";
77
<template>
88
<div class="flex flex-row gap-x-2 h-full w-full">
99
<div class="flex flex-col w-36 p-2">
10-
<RouterButton to-path="/" name="Home"/>
11-
<RouterButton to-path="/about" name="About"/>
12-
<RouterButton to-path="/helloworld" name="Hello World"/>
13-
<RouterButton to-path="/dynamicattributes" name="Dynamic Attributes"/>
14-
<RouterButton to-path="/styling" name="Styling"/>
15-
<RouterButton to-path="/nestedcomponents" name="Nested Component"/>
10+
<div class="flex flex-col">
11+
<h2>Introduction</h2>
12+
<RouterButton to-path="/helloworld" name="Hello World"/>
13+
<RouterButton to-path="/dynamicattributes" name="Dynamic Attributes"/>
14+
<RouterButton to-path="/styling" name="Styling"/>
15+
<RouterButton to-path="/nestedcomponents" name="Nested Component"/>
16+
<RouterButton to-path="/htmldirective" name="HTML Directive"/>
17+
</div>
18+
1619
</div>
1720
<div class="w-full">
1821
<RouterView />

Diff for: src/router/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ const router = createRouter({
3232
name: 'styling',
3333
component: () => import('../views/styling/StylingView.vue')
3434
},
35-
3635
{
3736
path: '/nestedcomponents',
3837
name: 'nestedcomponents',
3938
component: () => import('../views/NestedComponents/NestedComponentsView.vue')
39+
},
40+
{
41+
path: '/htmldirective',
42+
name: 'htmldirective',
43+
component: () => import('../views/htmldirective/HtmlDirectiveView.vue')
4044
}
4145
]
4246
})

Diff for: src/views/NestedComponents/default.js

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export const AppVue = `
55
</template>
66
77
<script setup>
8-
import { ref } from 'vue';
98
import NestedComponent from './NestedComponent.vue'
109
</script>
1110

Diff for: src/views/htmldirective/HtmlDirectiveView.vue

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script setup>
2+
import ReplWrapper from "@/components/ReplWrapper.vue";
3+
import {AppVue} from "@/views/htmldirective/default.js";
4+
</script>
5+
6+
<template>
7+
<ReplWrapper :code-string="AppVue"/>
8+
</template>

Diff for: src/views/htmldirective/default.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const AppVue = `
2+
<!-- Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to XSS attacks. Only use v-html on trusted content and never on user-provided content. -->
3+
<script setup>
4+
const htmlString = \`hello <b>world</b>\`;
5+
</script>
6+
7+
<template>
8+
<p v-html="htmlString"></p>
9+
</template>
10+
`.trimStart()

0 commit comments

Comments
 (0)