开发 ¶
seo ¶
- 官方
vue
<template>
<view>
</view>
</template>
<script setup>
usePageHead({
title: this.$setSeoTitle('订单管理')
});
</script>
- 自己封装
vue
<script setup>
import HttpObj from '@/utils/http';
import { buildHead } from '@/utils/seo.js';
buildHead({
title: '官网解决方案',
link: [
{ rel: 'stylesheet', href: '/pp/xxxx/css/xxx.css' },
]
});
</script>
css合并 ¶
https://www.volcengine.com/theme/3660282-R-7-1
cookie和store ¶
https://blog.csdn.net/m0_63281537/article/details/126699761
useState使用
在
~/composables
创建
pinia ¶
https://pinia.vuejs.org/zh/ssr/nuxt.html
滚动条 ¶
https://www.cnblogs.com/sese/p/17283886.html
路由中间件 ¶
在 ~/middleware
里面创建 ,会自动注册,例如 例如: ~/middleware/auth.global.js
js
export default defineNuxtRouteMiddleware((to, from) => {
console.log('--AuthRoleUser--', to, from);
// if (to.params.id === '1') {
// return abortNavigation();
// }
// return navigateTo('/');
const storeAuth = useState('store_auth');
if (!storeAuth.value.authenticated) {
return navigateTo('/');
}
});
- 参考