约拍宝,专为摄影爱好者准备的交互平台。可去官网扫码体验。
ios 已上架,欢迎使用

房间传送门2: https://www.mlxiu.com/room/70188
原子化 css 的好用是真的好用。
https://antfu.me/posts/reimagine-atomic-css-zh
https://juejin.cn/post/7028841960752283656
https://blog.csdn.net/qq_41499782/article/details/124074678
https://blog.csdn.net/sg_knight/article/details/124097860
https://github.com/unocss/unocss
https://github.com/unocss/unocss
这里用 pnpm 来安装。
pnpm add unocss -D
import vue from '@vitejs/plugin-vue'
import Unocss from 'unocss/vite'
import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
Unocss({})
]
})
import 'uno.css'
<div class="w-300px h-120px rounded-8px m-20px shadow-md">
</div>
仅仅用样式就可以实现宽300像素高120像素圆角8像素 margin 20 像素,带 md 程度的阴影的div盒子。这样多方便呀。
当你已经在使用了,可以通过 http://localhost:3000/__unocss 查看生成的 css 文件,是不是很人性化,文件量还小。
都说 pnpm vite vue 组合好。那就试试。
# shenya 是项目名
pnpm create vite shenya
cd shenya
pnpm install
pnpm run dev
如果从来没有使用过 pnpm,第一次创建的时候是要花一点时间。后边就是秒创建了哈。
vue cli 创建项目的时候,默认是不会 .env .env.production 这些文件的。一般,一个大型项目是需要用到不同环境的不同配置。这个时候,手动建立各个 .env 文件是必要的。起点就在 package.json 中的 scripts 里,默认就会有的。当然你可以手动定义名字,然后用 mode 指定。如:”staging”: “vue-cli-service serve –mode staging” 。
https://cli.vuejs.org/zh/guide/mode-and-env.html
如果是 vite 环境,不用 process,而是用 import.meta。 会有一些变化。请看:
nuxt 走约定大于配置的路线,有些问题需要注意一下下。特意记录下来。
试用 NuxtLayout 的时候,layouts 目录下的模板名不要叫 default.vue,会渲染成双倍的 div。
https://juejin.cn/post/7038957796351541261
https://juejin.cn/post/7080007366808666119
https://vue3js.cn/interview/vue/ssr.html
https://v3.nuxtjs.org/getting-started/quick-start
这里尝试下 vue ssr 项目。可是,真正应用到项目上,还得服务端做好支持和配置。pm2,nginx 这些也是要处理
演示结果:
个人喜欢用 yarn 的
npx nuxi init mengmeng
cd mengmeng
# 加入版本控制
git init
git add .
git commit -m 'nuxt 初始化项目'
yarn install
# 启动起来看看
yarn dev
一个 pc 端网站,通常有顶部,中间部分,底部三个部分构成,而顶部和底部,几乎是共用不变的。这种场景,我们很容易想到抽象成模板的方式来做。不过,网站除了这些共用外,还有其他地方共用,暂时就不考虑那么细致。
<template>
<div class="base-container">
<div class="header"></div>
<div class="body">
<slot></slot>
</div>
<div class="footer"></div>
</div>
</template>
<style>
*,
html,
body {
margin: 0;
padding: 0;
}
</style>
<style lang="scss" scoped>
.base-container {
display: flex;
flex-direction: column;
width: 100%;
min-height: 100vh;
.header {
display: flex;
width: 100%;
height: 80px;
background-color: aquamarine;
}
.body {
display: flex;
flex: 1;
}
.footer {
display: flex;
width: 100%;
height: 160px;
background-color: bisque;
}
}
</style>
<template>
<NuxtLayout name="base">
<div class="container">
<NuxtLink to="/meets"><h4>meets</h4></NuxtLink>
</div>
</NuxtLayout>
</template>
<script setup>
</script>
<style lang="scss" scoped>
.container {
display: flex;
flex-direction: column;
box-sizing: border-box;
padding: 20px 30px;
}
</style>
meets 是另一个路由对应文件,下边会建立。
– 新建 meets 目录,meets 下新建 index.vue 文件。index 是默认映射。 内容如下。
<template>
<div>
<NuxtLayout name="base">
<div class="container">
<NuxtLink to="/"><h4>home</h4></NuxtLink>
<NuxtLink to="/meets/5"><h4>详情一</h4></NuxtLink>
</div>
</NuxtLayout>
</div>
</template>
<script>
</script>
<style lang="scss" scoped>
.container {
display: flex;
flex-direction: column;
box-sizing: border-box;
padding: 20px 30px;
h4 {
margin-top: 12px;
}
}
</style>
/meets/5 是另一个路由文件,下边会建立
<template>
<NuxtLayout name="base">
<div class="container">
<h4>id {{ id }}</h4>
</div>
</NuxtLayout>
</template>
<script setup>
import { ref } from 'vue'
const route = useRoute()
const id = ref(route.params.id)
</script>
<style lang="scss" scoped></style>
这几个文件,串起来就可以组成首页、列表页、详情页三个页面。这刚好是一个项目最基本的构件。上边这些只是最基础最基础的一点点东西。要做好整个项目,这些是远远不够的。
https://next.vuetifyjs.com/en/getting-started/installation/
vue add vuetify
强迫症。不喜欢开机自启动向日葵。那么就关掉向日葵自启动吧。这里是 mac
打开终端,编辑下边这些文件,将
cd /Library/LaunchAgents/
sudo vim com.oray.sunlogin.agent.plist
sudo vim com.oray.sunlogin.startup.plist
cd /Library/LaunchDaemons
sudo vim com.oray.sunlogin.helper.plist
sudo vim com.oray.sunlogin.plist
https://github.com/barryvdh/laravel-debugbar
### 安装
composer require barryvdh/laravel-debugbar --dev
### 生成配置文件 config/debugbar.php
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
### 修改配置文件,设置 enabled 项
'enabled' => env('APP_DEBUG', false)
启用分析器后,网站底部会出现 debug 工具栏,可以看到执行的 mysql 语句等。可以发现和解决不合理的 ORM 问题。
近期评论