分类标签归档:Vue3

[ vscode前端调试 ]


你可以按照以下步骤在 VS Code 中进行前端调试:

在 package.json 里配置好启动脚本(如你的 "dev": "vite")。 在左侧的“运行和调试”视图(或按 ctrl + shift + d)中,点击“创建 launch.json 文件”,选择“Web App (Edge)”或“Web App (Chrome)”。 修改生成的 launch.json,将 url 改为你的本地开发服务器地址(如 http://localhost:5173)。 启动你的开发服务器(如点击 NPM 脚本的“dev”或在终端运行 npm run dev)。 在代码中点击行号左侧设置断点。 在“运行

< Read more >

[ vue3封装axios ]


requiest.js

import axios from "axios";
import { ElMessage } from "element-plus";

const apiService = axios.create();
const NETWORK_ERROR = "网络错误...";

// 请求前
// apiService.interceptors.request.use((config) => {
//     return config;
// }, (error) => {
//     retur

< Read more >

[ vue3项目搭建 ]


vue3项目搭基础结构

node v20.8.1

安装

  1. 安装cnpm
 npm install -g cnpm --registry=https://registry.npmmirror.com
 ```

2. 使用vite脚手架创建vue项目

cnpm create vite@latest my-vue-app --template vue

3. 启动项目

918 cd my-vue-app/ 920 cnpm install 950 npm run dev

4. 安装依赖(less, router, element-plus自动导入/图标)

cnpm ins

< Read more >

[ 图片粘贴[js] ]


粘贴图片使用

  1. 通过document.addEventListener('paste', function (event) {}) 改写原本的粘贴事件
  2. 查找粘贴版里的图片内容, 存在则上传图片到我自己的服务器
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>图片粘贴</title>
    <script src="https://cdn.jsdelivr.

< Read more >

[ 前端vue3部署 ]


拉取项目 创建docker-compose.yml - default.conf为nginx配置文件 - dist 为vue3打包的文件 - ssl_key为https证书文件

version: '3'
services:
  nginx:
    image: nginx
    restart: always
    ports:
      - "443:443"
      - "80:80"
    volumes:
      - ./conf/default.conf:/etc/nginx/conf.d/default.co

< Read more >

[ Vue3-组件传参-监控 ]


Vue3组件使用, watch监控组件参数

1. 父组件

  • 传给子组件的数据类型为ref
  • 而且前面要写v-model:才是<父组件>-<子组件>数据双向传递

xxx.vue

<template>
    <notebookmain v-model:editor_content="editor_content_ref" v-model:editor_title="editor_title_ref"></notebookmain>
</template>

<script>

< Read more >