1
This commit is contained in:
51
Web/syseye/src/components/EssentialLink.vue
Normal file
51
Web/syseye/src/components/EssentialLink.vue
Normal file
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<q-item
|
||||
clickable
|
||||
tag="a"
|
||||
target="_blank"
|
||||
:href="link"
|
||||
>
|
||||
<q-item-section
|
||||
v-if="icon"
|
||||
avatar
|
||||
>
|
||||
<q-icon :name="icon" />
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
<q-item-label>{{ title }}</q-item-label>
|
||||
<q-item-label caption>
|
||||
{{ caption }}
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'EssentialLink',
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
|
||||
caption: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
|
||||
link: {
|
||||
type: String,
|
||||
default: '#'
|
||||
},
|
||||
|
||||
icon: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
37
Web/syseye/src/components/Html.Vue
Normal file
37
Web/syseye/src/components/Html.Vue
Normal file
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<div v-html="html"></div>
|
||||
</template>
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
props: { url: { required: true } },
|
||||
data () {
|
||||
return { html: '' }
|
||||
},
|
||||
watch: {
|
||||
url (value) {
|
||||
this.load(value)
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.load(this.url)
|
||||
},
|
||||
methods: {
|
||||
load (url) {
|
||||
if (url && url.length > 0) {
|
||||
const param = { accept: 'text/html, text/plain' }
|
||||
axios
|
||||
.get(url, param)
|
||||
.then((response) => {
|
||||
this.html = response.data
|
||||
})
|
||||
.catch(() => {
|
||||
this.html = '加载失败'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user