update app.vue

This commit is contained in:
wzz 2022-10-19 16:05:21 +08:00
parent 3037006490
commit 36b7a5de38
1 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,9 @@
<script setup> <script setup>
import { onBeforeMount, onMounted } from "vue"; import { onBeforeMount, onMounted ,getCurrentInstance} from "vue";
const { appContext } = getCurrentInstance()
const proxy = appContext.config.globalProperties;
const data = { const data = {
keys: "", keys: "",
}; };
@ -9,7 +13,7 @@ const Search = () => {
}; };
onMounted(() => { onMounted(() => {
this.$api.get('/status').then((response)=>{ proxy.$api({url:"/status",method:"get"}).then((response)=>{
console.log(response) console.log(response)
}); });
}); });
@ -26,9 +30,9 @@ onBeforeMount(() => {});
<label class="relative block"> <label class="relative block">
<span class="sr-only">Search</span> <span class="sr-only">Search</span>
<span class="absolute inset-y-0 left-0 flex items-center pl-2"> <span class="absolute inset-y-0 left-0 flex items-center pl-2">
<svg class="h-5 w-5 fill-slate-300" viewBox="0 0 20 20"></svg> <svg class="w-5 h-5 fill-slate-300" viewBox="0 0 20 20"></svg>
</span> </span>
<input class="max-w-sm placeholder:italic placeholder:text-slate-400 block bg-white w-full border border-slate-300 rounded-md py-2 pl-9 pr-3 shadow-sm focus:outline-none focus:border-sky-500 focus:ring-sky-500 focus:ring-1 sm:text-sm" placeholder="Search for anything..." type="text" name="search" v-model="data.keys" v-on:keyup.enter="Search()"/> <input class="block w-full max-w-sm py-2 pr-3 bg-white border rounded-md shadow-sm placeholder:italic placeholder:text-slate-400 border-slate-300 pl-9 focus:outline-none focus:border-sky-500 focus:ring-sky-500 focus:ring-1 sm:text-sm" placeholder="Search for anything..." type="text" name="search" v-model="data.keys" v-on:keyup.enter="Search()"/>
</label> </label>
</div> </div>
</div> </div>