Skip to content

Commit

Permalink
首页提示弹出添加缓存
Browse files Browse the repository at this point in the history
  • Loading branch information
yinMrsir committed Apr 7, 2023
1 parent 7856805 commit 108ee94
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
37 changes: 22 additions & 15 deletions Nuxt-web/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,22 @@
v-model="searchValue"
@keyup.enter.native="handleSearch"
/>
<template v-if="userInfo">
<el-dropdown @command="handleCommand">
<el-button circle :icon="UserFilled" color="#155FAA"></el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="user">个人中心</el-dropdown-item>
<el-dropdown-item divided command="logOut">退出</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<template v-else>
<el-button circle :icon="UserFilled" @click="goLogin"></el-button>
</template>
<ClientOnly>
<template v-if="userInfo">
<el-dropdown @command="handleCommand">
<el-button circle :icon="UserFilled" color="#155FAA"></el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="user">个人中心</el-dropdown-item>
<el-dropdown-item divided command="logOut">退出</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<template v-else>
<el-button circle :icon="UserFilled" @click="goLogin"></el-button>
</template>
</ClientOnly>
</div>
</div>
<div class="mobile-nav hidden-sm-only hidden-sm-and-up">
Expand All @@ -55,8 +57,9 @@
</template>

<script setup>
import { Search, UserFilled } from '@element-plus/icons-vue'
import { Search, UserFilled} from '@element-plus/icons-vue'
import { useFetch } from "nuxt/app";
import { ElMessage } from "element-plus";
const { proxy } = getCurrentInstance()
const userInfo = useCookie('userInfo')
Expand All @@ -78,6 +81,10 @@ function handleCommand(command) {
logOut()
break;
default:
ElMessage({
message: '开发中...',
type: 'info',
});
break;
}
}
Expand Down
7 changes: 6 additions & 1 deletion Nuxt-web/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@

<script setup>
import {useFetch} from "#app";
import {useCookie} from "nuxt/app";
const warmReminder = useCookie('warmReminder', { maxAge: 60 * 60 })
const visible = ref(false)
const banner = ref([])
const list = ref([])
Expand All @@ -52,7 +54,10 @@ list.value = data.value.movieDataList
const dialogWidth = ref('')
onMounted(() => {
visible.value = true
if (!warmReminder.value) {
visible.value = true
warmReminder.value = '1'
}
dialogWidth.value = window.innerWidth > 600 ? '30%' : '320px'
})
Expand Down

0 comments on commit 108ee94

Please sign in to comment.