App.vue
Код: Выделить всё
import axios from 'axios'
import { ref, onMounted } from 'vue'
import Layout from "./components/Layout.vue"
import HelloWorld from "./components/HelloWorld.vue"
import DataTable from "./components/DataTable.vue"
import Table2 from "./components/Table2.vue"
const content = ref('')
const author = ref('')
onMounted(async () => {
try {
// Read credentials from Vite environment variables when available. These should be set as
// VITE_API_USER and VITE_API_PASS in a .env file (not committed).
const apiUser = import.meta.env.VITE_API_USER || 'APIUSER'
const apiPass = import.meta.env.VITE_API_PASS || 'APIPASS'
const response = await axios.get("http://srhttiedev.srht.nhs.uk/api/winpathmissingresultaudit/", {
auth: {
username: apiUser,
password: apiPass
}
})
content.value = await response.data
} catch (e) {
content.value = 'Failed to fetch quote.'
}
})
< /code>
тот, который я хочу работать < /p>
// Define props properly in script setup
const props = defineProps({
items: {
type: Array,
required: true
}
})
import EasyDataTable from 'vue3-easy-data-table';
// CSS for the table component
import 'vue3-easy-data-table/dist/style.css';
const headers: Header[] = [
{ text: "SpecimenID", value: "player" },
{ text: "HospitalNo", value: "team"},
{ text: "NHSNo", value: "number"},
{ text: "Patient Name", value: "position"},
{ text: "Source Code", value: "indicator.height"},
{ text: "Source Desc", value: "indicator.weight", sortable: true},
{ text: "Source Classification Code", value: "lastAttended", width: 200},
{ text: "Source Class Desc", value: "country"},
];
< /code>
Тот, который работает, но я бы предпочел использовать библиотеку, потому что даст мне больше вариантов < /p>
// Define props properly in script setup
const props = defineProps({
items: {
type: Array,
required: true
}
})
SpecimenID
Hospital Number
HospitalNo Type
NHSNo
Patient Name
Source Code
Source Desc
Source Classification Code
Source Class Desc
Message Date
Actioned?
{{item.specID}}
{{item.hospNo}}
{{item.hospNoType}}
{{item.patientName}}
{{item.sourceCode}}
{{item.sourceDesc}}
{{item.sourceCCode}}
{{item.sourceCDesc}}
{{item.msgDate}}
{{item.actioned}}
[url=#] Details[/url]
Подробнее здесь: https://stackoverflow.com/questions/797 ... ot-working