diff --git a/src/components/MedSearch.vue b/src/components/MedSearch.vue index 300d89b..13fd35f 100644 --- a/src/components/MedSearch.vue +++ b/src/components/MedSearch.vue @@ -6,13 +6,14 @@ {{ item.med_code }} : {{ item.name }} + {{ item }} @@ -35,10 +36,21 @@ export default { created() { this.allMeds() }, + computed: { + filteredMeds() { + let q = this.med_search.toLowerCase() + if (q == ""){ return this.meds } + let ms = this.meds.filter(m => + m.name.toLowerCase().includes(q) || + m.med_code.toLowerCase().includes(q) + ) + return ms + } + }, methods: { allMeds(){ this.meds_loading = true - console.log("Searching for " + this.med_search) + console.log("All Meds...") let url = this.$api_url + "/meds/list" axios.get(url) .then(resp => {