# shopvue
**Repository Path**: ningdiadmin/shopvue
## Basic Information
- **Project Name**: shopvue
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-10-25
- **Last Updated**: 2024-11-15
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
sudo chmod -R 777 * && git add . && git commit -m 'Submit Code' && git push origin master
/project
.gitignore git仓库忽略文件
index.html 页面入口文件
package.json 安装包依赖文件
vite.config.js vite配置文件 === config.php
node_modules/ 依赖包 === vender
public/ 公共访问目录 === public
dist/ 打包目录
src/ 开发逻辑目录 === application
/src
App.vue 项目入口文件 === view/layout.html
main.js 项目的核心文件 === public/index.php
assets/ 放置一些图片,如logo等
components/ 组件目录 ==== view 视图
package.json -> npm 创建出来的
scripts -> 命令列表
dependencies -> 生产阶段依赖包
devDependencies -> 开发阶段依赖包
启动命令
npm run dev
yarn dev
找东西:
1、index.html (程序的入口文件、vue应用的div容器 id=app)
import { createApp } from 'vue' 引入vue框架
App -> 根组件(父组件)
HelloWorld.vue(子组件)
Thinkphp MVC
Vue M V VM(视图模型-控制器-组件)
Vue 风格代码 Vue2/Vue3
Vue2 选项式的风格
{
data:{}
methods:{},
computed:{},
watch:{},
onCreated(){}
}
Vue3 组合式的风格 == php通讯录很相似 上面php 下面的html
Vue2 -> Object.defineProperty 定义属性的方法
Vue3 -> Proxy 代理对象 完成数据的绑定
父子通信
父->子:传递属性props
子->父:传递事件方法event(emits)
全局的传参方式
传递:provide('demo')
接收:inject('demo')
v-if 只会渲染满足条件的一条
v-show 会直接插入到页面中 只是通过css 设置显示还是隐藏而已
万能标签
插槽
头部
slot -> 组件内插槽
teleport -> index.html 全局入口页面的插槽
安装路由
npm install vue-router@4
yarn add vue-router@4
#/
# 锚点功能 hash模式
/ 默认路由
Vue 单页面应用
path: /info/:pid -> params 传参 跳转需要用 name 属性来跳转
path: /search -> query 传参 跳转就正常使用 path 属性来跳转
/business/index
/business/profile
/business/login
路由嵌套
/business -> 父路由
/index -> 子路由
/profile
/login
Vue -> 声明周期 beforeMounted onMounted
Router -> 钩子函数全局 beforeEach(进入路由前) afterEach(进入路由后)
/business/index 进入路由前,判断是否登录,meta:{auth:true}