SSM项目实战-前端-在Index.vue中展示第一页数据

1、util/request.js

import axios from "axios";

let request = axios.create({
    baseURL: "http://localhost:8080",
    timeout: 50000
});

export default request

2、api/schedule.js

import request from "../util/request.js";

export let getScheduleList = (queryvo) => {
    return request.get(`/schedule/${queryvo.pageNum}`,{
        params:{
            uid:queryvo.uid
        }
    })
};
export let updateSchedule=data=>{
    return request.put("/schedule",data)
}
export let saveSchedule=data=>{
    return request.post("/schedule",data)
}
export let delSchedule=id=>{
    return request.delete(`/schedule/${id}`)
}

3、Index.vue




SSM项目实战-前端-在Index.vue中展示第一页数据_第1张图片

 7、模板字符串 ``

在ES6(ECMAScript 2015)中,模板字符串是一种新的字符串类型,它使用 反引号(`) 来定义,可以包含嵌入式表达式(即${expression})。模板字符串的出现为JavaScript提供了更灵活和强大的字符串处理能力。

模板字符串的主要作用包括:

  1. 格式化字符串:通过使用嵌入式表达式,可以将变量或表达式的值直接嵌入到字符串中。这使得字符串的格式化更为方便和直观。例如:

let name = "John";  
let greeting = `Hello, ${name}!`; // 输出 "Hello, John!"
  1. 多行字符串:模板字符串可以包含多行内容,这对于处理多行文本或代码非常有用。例如:

let multiLineString = `This is a   
multi-line   
string.`; // 输出一个跨越多行的字符串
  1. 字符串插值:通过使用嵌入式表达式 ${expression},可以在字符串中插入变量或表达式的值。这使得字符串的动态生成更为简单。例如:

let name = "John";  
let message = `My name is ${name}.`; // 输出 "My name is John."
  1. 转义字符:模板字符串中,反斜杠(\)用于转义字符,可以用来表示特殊字符(如换行符、制表符等)。例如:

let escapedString = `\n represents a new line.`; // 输出 "\ represents a new line."

在实际开发项目中,模板字符串可以帮助你更方便地处理字符串,提高代码的可读性和可维护性。特别是在处理复杂的字符串逻辑时,模板字符串可以使得代码更加清晰和易于理解。

你可能感兴趣的:(SSM整合实战,Vue3,Vite,Element-Plus,路径传参,查询字符串传参,模板字符串,params)