154 lines
5.1 KiB
Vue
154 lines
5.1 KiB
Vue
<script>
|
|
import "~/assets/styles/BackendNavEntry.Bx6IPica.css";
|
|
import "~/assets/styles/BackendNavigation.CEj4LnzI.css";
|
|
import { renderList } from "vue";
|
|
import { onMounted } from "vue";
|
|
import { onBeforeUnmount } from "vue";
|
|
import { renderSlot } from "vue";
|
|
import { createBlock } from "vue";
|
|
import { createCommentVNode } from "vue";
|
|
import { createElementBlock } from "vue";
|
|
import { Fragment } from "vue";
|
|
import { createElementVNode } from "vue";
|
|
import { unref } from "vue";
|
|
import { defineComponent } from "vue";
|
|
import { createVNode } from "vue";
|
|
import { openBlock } from "vue";
|
|
import { useApi } from "~/lib/auth.js";
|
|
import { useAuth } from "~/lib/auth.js";
|
|
import { t as navigation_state_t } from "~/lib/navigation-state.js";
|
|
import button from "primevue/button";
|
|
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
|
import BackendNavEntry from "~/components/BackendNavEntry.vue";
|
|
var y = {
|
|
key: 1,
|
|
class: `nav-placeholder`,
|
|
role: `status`,
|
|
"aria-label": `正在加载导航`,
|
|
},
|
|
b = {
|
|
key: 2,
|
|
class: `nav-load-error`,
|
|
role: `status`,
|
|
},
|
|
x = Object.assign(
|
|
_plugin_vue_export_helper_t(
|
|
defineComponent({
|
|
__name: `BackendNavigation`,
|
|
emits: [`loaded`],
|
|
setup(u, { emit: _ }) {
|
|
let x = _,
|
|
S = useApi(),
|
|
C = navigation_state_t(useAuth(), S),
|
|
{ entries: w, loading: T, error: E, loaded: D } = C,
|
|
O = !0;
|
|
onBeforeUnmount(() => {
|
|
O = !1;
|
|
});
|
|
async function k() {
|
|
(await C.load(!!E.value),
|
|
O && D.value && x(`loaded`, w.value, C.authoritative.value));
|
|
}
|
|
return (
|
|
onMounted(k),
|
|
(t, n) => {
|
|
let u = BackendNavEntry,
|
|
p = button;
|
|
return (
|
|
openBlock(),
|
|
createElementBlock(
|
|
Fragment,
|
|
null,
|
|
[
|
|
unref(D)
|
|
? renderSlot(
|
|
t.$slots,
|
|
`default`,
|
|
{},
|
|
() => [
|
|
(openBlock(!0),
|
|
createElementBlock(
|
|
Fragment,
|
|
null,
|
|
renderList(
|
|
unref(w),
|
|
(e) => (
|
|
openBlock(),
|
|
createBlock(
|
|
u,
|
|
{
|
|
key: e.key,
|
|
entry: e,
|
|
siblings: unref(w),
|
|
},
|
|
null,
|
|
8,
|
|
[`entry`, `siblings`],
|
|
)
|
|
),
|
|
),
|
|
128,
|
|
)),
|
|
],
|
|
!0,
|
|
0,
|
|
)
|
|
: unref(E)
|
|
? createCommentVNode(``, !0)
|
|
: (openBlock(),
|
|
createElementBlock(`div`, y, [
|
|
(openBlock(),
|
|
createElementBlock(
|
|
Fragment,
|
|
null,
|
|
renderList(10, (e) =>
|
|
createElementVNode(`span`, {
|
|
key: e,
|
|
}),
|
|
),
|
|
64,
|
|
)),
|
|
])),
|
|
unref(E)
|
|
? (openBlock(),
|
|
createElementBlock(`div`, b, [
|
|
(n[0] ||= createElementVNode(
|
|
`span`,
|
|
null,
|
|
`导航加载失败`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
p,
|
|
{
|
|
label: `重试`,
|
|
size: `small`,
|
|
text: ``,
|
|
severity: `secondary`,
|
|
disabled: unref(T),
|
|
onClick: k,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
],
|
|
64,
|
|
)
|
|
);
|
|
}
|
|
);
|
|
},
|
|
}),
|
|
[[`__scopeId`, `data-v-02b58e93`]],
|
|
),
|
|
{
|
|
__name: `BackendNavigation`,
|
|
},
|
|
);
|
|
export {};
|
|
export default x;
|
|
</script>
|