摘要://删除请求 async function DeleteModel(model: Customer) { let url = `http://localhost:57679/api/Customers/${model.id}` await fetch(url, { method: 'delete'
阅读全文
摘要:http://www.axios-js.com/ API测试资源 https://jsonplaceholder.typicode.com/ Fetch API Element UI 控件使用指南 https://cloud.tencent.com/developer/section/1489873
阅读全文
摘要:路由组件显示占位符 <router-view></router-view> 使用路径path 或 name 在标签中导航 <RouterLink to="ClassTest">Class</RouterLink>| <RouterLink :to="{name:'TypeTest'}">TypeTe
阅读全文
摘要:构建应用 设置打包时的相对路径 vite.config.ts // https://vitejs.dev/config/ export default defineConfig({ plugins: [vue()], resolve: { alias: { '@': fileURLToPath(ne
阅读全文
摘要:一、定义状态变量、方法 在 src\stores\ 目录下,新建状态管理文件 counter.ts 为了确保改变状态的逻辑像状态本身一样集中,建议在 store 上定义方法,方法的名称应该要能表达出行动的意图: import { ref, computed } from 'vue' import {
阅读全文
摘要:Ajax - 使用XMLHttpRequest对象进行异步请求,极大的提高了用户体验,实现了页内请求 Fetch - Ajax的替代者,浏览器内置方法,封装了Promise机制,优化了异步问题 axios、request等众多第三方开源库:对原生方法的二次封装,各有优劣势 二、关于Fetch API
阅读全文
摘要:快捷方式创建 Vue 组件模板 新建文件 Login.vue 然后打开文件,并输入 vbase ,再在提示列表中选择 vbase-3-ts-setup,最后按回车确定,此时系统会自动生成以下文本 <template> <div> </div> </template> <script setup la
阅读全文
摘要:<template> <button v-for="tab in tabs" :key="tab" @click="currentTab = tab.component"> {{ tab.name }} </button> <component :is="currentTab ? currentTa
阅读全文
摘要:import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ e
阅读全文
摘要:Axios 是什么? Axios 是一个基于 promise 网络请求库,作用于node.js 和浏览器中。 在服务端它使用原生 node.js http 模块, 而在客户端 (浏览端) 则使用 XMLHttpRequests。 官方文档:http://www.axios-js.com/zh-cn/
阅读全文
摘要:参考:TypeScript interface 接口 <template> <div> <p>{{ fullName }}</p> </div> </template> <script lang="ts" setup> import { ref } from 'vue'; interface Per
阅读全文
摘要:Fetch使用 Get=(url)=>{ fetch(url)//默认是GET .then(response=>response.json())//把数据解析成json格式,然后取出 .then(result=>{ this.setState({ result:JSON.stringify(resu
阅读全文
摘要:1.简单区分 2.请求方式 axios传一个对象,里面包含请求url和请求方法,参数。 fetch传两个参数,第一个是请求url,第二个是请求的一些参数。 // axios请求: const options = { url: "http://yuque.com/", method: "POST",
阅读全文
摘要:打开 vite.config.js ,配置端口和代理 //解决CORS跨域问题和统一API域名请求 server: { host: '127.0.0.1', port: 3001,//Vue启动端口地址,设置后需要重新编译Vue open: true,//编译后自动打开浏览器 proxy: { '/
阅读全文
摘要:分页 <el-pagination background layout="prev, pager, next" :total="total" @current-change="currentChange" /> const total = ref(100); function currentChan
阅读全文
摘要:安装 # 选择一个你喜欢的包管理器 # NPM $ npm install element-plus --save # Yarn $ yarn add element-plus # pnpm $ pnpm install element-plus 完整引入 如果你对打包后的文件大小不是很在乎,那么使
阅读全文
摘要:编译项目后,自动打开浏览器 npm run dev 在vite.config.js 文件中添加 server节点 export default defineConfig({ plugins: [vue()], resolve: { alias: { '@': fileURLToPath(new UR
阅读全文