<template>
    <div class="content">
        <div class="common">
            【{{ data.npcName }}】
        </div>
        <div class="common">
            {{ data.story }}
        </div>
    </div>
    <div class="content">
        <div class="item" v-for="item in data.bus">
            ◈<Abar :href="item.url">{{ item.name }}</Abar>
        </div>
    </div>
</template>
<script setup lang="ts">

definePageMeta({
    layout: layout.default,
    middleware: 'page-loading'
})
const data = ref<any>({});

onMounted(async () => {
    try {
        await BindData();
    }
    finally {
        PageLoading.Close();
    }
})



const BindData = async (): Promise<void> => {
    let npc = PageExtend.QueryString("npc");
    let result = await MapService.GetNpcInfo(Number(npc));
    if (result.code == 0) {
        data.value = result.data;        
        LocalStorageHelper.SetOnNpc(npc);//存储当前进的npc信息        
    }
    else {
        MessageExtend.ShowDialogEvent("提示", result.msg, () => {
            PageExtend.Redirect("/map");
        });
    }
};

</script>