# zm-travel
**Repository Path**: wzm_love_coding/zm-travel
## Basic Information
- **Project Name**: zm-travel
- **Description**: 这是一个Vue3+vite+vant+pinia的民宿公寓项目
- **Primary Language**: JavaScript
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2023-08-06
- **Last Updated**: 2023-08-17
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# zm-trip
## 项目搭建
## 集成百度地图
- 在 html 中引入
```html
```
- 在组件中使用
```js
```
## 首页缓存 keep-alive
```html
```
```js
```
## 记录页面位置
```js
const homeRef = ref()
const { isReachBottom, scrollTop } = useScroll(homeRef)
watch(isReachBottom, (newVal) => {
if (newVal) {
homeStore.getHomeListAction().then(() => {
isReachBottom.value = false
})
}
})
// 跳回home页时,停留在原来的位置
onActivated(() => {
homeRef.value?.scrollTo({
top: scrollTop.value
})
})
.home {
margin-bottom: 50px;
height: 100vh;
box-sizing: border-box;
overflow-y: auto;
}
```
## 视口设置和 pxtovw 单位的转换
```html
```
- `npm i postcss-px-to-viewport -D`
- 项目根目录创建 postcss.config.js 文件
```js
module.exports = {
plugins: {
'postcss-px-to-viewport': {
viewportWidth: 375
}
}
}
```