thelounge/client/components/ParsedMessage.vue
Max Leiter dd05ee3a65
TypeScript and Vue 3 (#4559)
Co-authored-by: Eric Nemchik <eric@nemchik.com>
Co-authored-by: Pavel Djundik <xPaw@users.noreply.github.com>
2022-06-18 17:25:21 -07:00

22 lines
606 B
Vue

<script lang="ts">
import {defineComponent, PropType, h} from "vue";
import parse from "../js/helpers/parse";
import type {ClientMessage, ClientNetwork} from "../js/types";
export default defineComponent({
name: "ParsedMessage",
functional: true,
props: {
text: String,
message: {type: Object as PropType<ClientMessage | string>, required: false},
network: {type: Object as PropType<ClientNetwork>, required: false},
},
render(context) {
return parse(
typeof context.text !== "undefined" ? context.text : context.message.text,
context.message,
context.network
);
},
});
</script>