完成首页UI
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
const { user } = storeToRefs(useStore());
|
||||
|
||||
const props = defineProps({
|
||||
selected: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
onSignin: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
onChange: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
@@ -32,6 +40,10 @@ const onTabChange = (index) => {
|
||||
});
|
||||
}
|
||||
if (index === 4) {
|
||||
if (!user.value.id) {
|
||||
props.onSignin();
|
||||
return;
|
||||
}
|
||||
return uni.navigateTo({
|
||||
url: "/pages/user",
|
||||
});
|
||||
@@ -39,7 +51,9 @@ const onTabChange = (index) => {
|
||||
// props.onChange(index);
|
||||
};
|
||||
const getTabSrc = (key, index) => {
|
||||
return `../static/tab-${tabs[key]}${props.selected === index ? "" : "-o"}.png`;
|
||||
return `../static/tab-${tabs[key]}${
|
||||
props.selected === index ? "" : "-o"
|
||||
}.png`;
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user