mediawiki-extensions-SearchVue/resources/components/sections/QuickViewSnippet.vue
Umherirrender 0fa8e18b85 build: Run stylelint for vue files
Change-Id: Iabb7aae258d6a5eb1be3a7fe0a9f90f4735ec880
2022-11-19 11:38:17 +01:00

60 行
1.1 KiB
Vue

<template>
<div class="quickViewSnippet">
<!-- eslint-disable vue/no-v-html -->
<p v-html="text"></p>
<a :href="url" @click.prevent="onClick">{{ gotoFullPageText }}</a>
</div>
</template>
<script>
/**
* @file QuickViewSnippet.vue
*
* Placeholder
*/
// @vue/component
module.exports = exports = {
name: 'QuickViewSnippet',
props: {
title: {
type: String,
required: true
},
text: {
type: String,
required: true
}
},
computed: {
url() {
const title = new mw.Title( this.title );
return title.getUrl();
},
gotoFullPageText() {
const namespace = new mw.Title( this.title ).getNamespaceId();
return this.$i18n( 'searchvue-snippet-gotofullpage-ns' + namespace ).exists() ?
this.$i18n( 'searchvue-snippet-gotofullpage-ns' + namespace ).text() :
this.$i18n( 'searchvue-snippet-gotofullpage' ).text();
}
},
methods: {
onClick() {
this.$emit(
'log-event',
{
action: 'click-snippet',
goTo: this.url
} );
}
}
};
</script>
<style>
.quickViewSnippet {
width: 365px;
margin: 0 auto 20px;
}
</style>