mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-08 23:14:43 -04:00
(vue) import h() instead of using it as parameter
https://v3-migration.vuejs.org/breaking-changes/render-function-api.html
This commit is contained in:
parent
c1faf15117
commit
52895b9149
@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { NuxtLink } from '#components';
|
||||
import { defineComponent, h } from 'vue';
|
||||
import Icon from './Icon.vue';
|
||||
import spelling from '../plugins/spelling.ts';
|
||||
import { escapeHtml } from '../src/helpers.ts';
|
||||
@ -11,7 +12,7 @@ export default defineComponent({
|
||||
noicons: { type: Boolean },
|
||||
escape: { type: Boolean },
|
||||
},
|
||||
render(h) {
|
||||
render() {
|
||||
let text = this.text;
|
||||
if (this.escape) {
|
||||
text = escapeHtml(text);
|
||||
@ -31,7 +32,7 @@ export default defineComponent({
|
||||
return h(Icon, { v: buffer });
|
||||
}
|
||||
|
||||
const bufferNode = h('span', { domProps: { innerHTML: this.handleSpelling(buffer) } });
|
||||
const bufferNode = h('span', { innerHTML: this.handleSpelling(buffer) });
|
||||
|
||||
if (!isLink) {
|
||||
return bufferNode;
|
||||
@ -50,7 +51,7 @@ export default defineComponent({
|
||||
) {
|
||||
return h(
|
||||
'a',
|
||||
{ domProps: { href: linkBuffer, target: '_blank', rel: 'noopener' } },
|
||||
{ href: linkBuffer, target: '_blank', rel: 'noopener' },
|
||||
[bufferNode],
|
||||
);
|
||||
}
|
||||
@ -58,15 +59,15 @@ export default defineComponent({
|
||||
if (linkBuffer.indexOf('#') === 0) {
|
||||
return h(
|
||||
'a',
|
||||
{ domProps: { href: linkBuffer } },
|
||||
{ href: linkBuffer },
|
||||
[bufferNode],
|
||||
);
|
||||
}
|
||||
|
||||
return h(
|
||||
'nuxt-link',
|
||||
{ props: { to: linkBuffer || `/${this.$config.nouns.route}#${this.handleSpelling(buffer)}` } },
|
||||
[bufferNode],
|
||||
NuxtLink,
|
||||
{ to: linkBuffer || `/${this.$config.nouns.route}#${this.handleSpelling(buffer)}` },
|
||||
() => [bufferNode],
|
||||
);
|
||||
};
|
||||
const addChild = (): void => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { defineComponent, h } from 'vue';
|
||||
import spelling from '../plugins/spelling.ts';
|
||||
import { escapeHtml } from '../src/helpers.ts';
|
||||
import { safeInlineMarkdown } from '../src/simpleMarkdown.ts';
|
||||
@ -10,7 +10,7 @@ export default defineComponent({
|
||||
escape: { type: Boolean },
|
||||
markdown: { type: Boolean },
|
||||
},
|
||||
render(h) {
|
||||
render() {
|
||||
let text = this.text;
|
||||
text = text.replace('<script', '');
|
||||
if (this.escape) {
|
||||
@ -20,7 +20,7 @@ export default defineComponent({
|
||||
text = safeInlineMarkdown(text);
|
||||
}
|
||||
|
||||
return h('span', { domProps: { innerHTML: this.handleSpelling(text) } });
|
||||
return h('span', { innerHTML: this.handleSpelling(text) });
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user