16---实现权限菜单管理(一)

news2024/9/28 15:31:37

1、实现角色管理

  1. 建role表
USE `management`;
DROP TABLE IF EXISTS `role`;

CREATE TABLE `role` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `name` varchar(50) DEFAULT NULL COMMENT '名称',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

接下来的操作可以用代码生成器一键生成

  1. 写实体类Role.java
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "role")
public class Role {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String name;
    private String description;
}
  1. 写mapper层 RoleMapper.java
@Repository
public interface RoleMapper extends BaseMapper<Role> {
}
  1. 写service层RoleService.java
@Service
public class RoleService extends ServiceImpl<RoleMapper, Role> {
}

  1. 写controller层 RoleController.java
@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;



    //插入和修改操作
    @PostMapping
    public Result save(@RequestBody Role role){
        return Result.success(roleService.saveOrUpdate(role));
    }

    //查询所有数据
    @GetMapping
    public Result findAll(){
        return Result.success(roleService.list());
    }

    //删除
    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Integer id){
        return Result.success(roleService.removeById(id));
    }

    //批量删除
    @PostMapping ("/del/batch")
    public Result deleteBatch(@RequestBody List<Integer> ids){
        return Result.success(roleService.removeBatchByIds(ids));
    }

    //根据id查找用户信息
    @GetMapping("{id}")
    public Result findOneById(@PathVariable Integer id){
        return Result.success(roleService.getById(id));
    }

    //分页查询
    @GetMapping("/page")
    public Result findPage(@RequestParam Integer pageNum,
                           @RequestParam Integer pageSize,
                           @RequestParam String name){
        QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
        if (! "".equals(name)){
            queryWrapper.like("name",name);
        }
        queryWrapper.orderByDesc("id");
        return Result.success(roleService.page(new Page<>(pageNum,pageSize),queryWrapper));

    }
}

  1. 前端写Role页面 Role.vue
<template>
    <div>
     <div style="padding:10px 0">
       <el-input style="width:200px" placeholder="请输入名称" suffix-icon="el-icon-search" v-model="name"></el-input>
       <el-button class="ml-5" type="primary" @click="load">搜索</el-button>
       <el-button  type="warning" @click="reset">重置</el-button>
      
     </div>

     <div style="margin:10px 0">
       <el-button type="primary" @click="handleAdd">新增<i class="el-icon-circle-plus-outline"></i></el-button>
       <el-popconfirm
                class="ml-5"
                confirm-button-text='确定'
                cancel-button-text='我再想想'
                icon="el-icon-info"
                icon-color="red"
                title="您确定要删除这些内容吗?"
                @confirm="delBatch"
          >
          <el-button type="danger"  slot="reference">批量删除<i class="el-icon-remove-outline"></i></el-button>
          </el-popconfirm>
     </div>
     <el-table :data="tableData" border stripe :header-cell-calss-name="'headerBg'"    @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55"></el-table-column>
      <el-table-column prop="id" label="ID" width="80"></el-table-column>
       <el-table-column prop="name" label="名称" ></el-table-column>
       <el-table-column prop="description" label="描述" ></el-table-column>
       <el-table-column label="操作" width="280" align="center">
         <template slot-scope="scope" >
          <el-button type="info" @click="selectMenu(scope.row.id)">分配菜单<i class="el-icon-menu"></i></el-button>

           <el-button type="success" @click="handleUpdate(scope.row)">编辑 <i class="el-icon-edit"></i></el-button>
          <el-popconfirm
                class="ml-5"
                confirm-button-text='确定'
                cancel-button-text='我再想想'
                icon="el-icon-info"
                icon-color="red"
                title="您确定要删除吗?"
                @confirm="handleDelete(scope.row.id)"
          >
          <el-button type="danger" slot="reference">删除<i class="el-icon-remove-outline"></i></el-button>
          </el-popconfirm>
         </template>
       </el-table-column>
     </el-table>
     <div style="padding:10px 0">
       <el-pagination
       @size-change="handleSizeChange"
       @current-change="handleCurrentChange"
         :current-page="pageNum"
         :page-sizes="[2, 4, 6, 10]"
         :page-size="pageSize"
         layout="total, sizes, prev, pager, next, jumper"
         :total="total">
       </el-pagination>
     </div>

      <el-dialog title="角色信息" :visible.sync="dialogFormVisible" width="30%">
        <el-form label-width="80px" size="small">
          <el-form-item label="名称" >
            <el-input v-model="form.name" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="描述" >
            <el-input v-model="form.description" autocomplete="off"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="save">确 定</el-button>
        </div>
      </el-dialog>

      <el-dialog title="分配菜单" :visible.sync="menuDialogVisable" width="30%">
        <el-tree
            :data="menuData"
            show-checkbox
            node-key="id"
            :default-expanded-keys="[1]"
            :default-checked-keys="[4]"
            @check-change="handleCheckChange">
        </el-tree>
        <div slot="footer" class="dialog-footer">
          <el-button @click="menuDialogVisable = false">取 消</el-button>
          <el-button type="primary" @click="save">确 定</el-button>
        </div>
      </el-dialog>
    </div>
</template>

<script>
export default{
    name:"User",
    data() {
     return {
       tableData:[],
       total: 0 ,
       pageNum:1,
       pageSize:4,
       name:"",
       form:{},
       dialogFormVisible:false,
       menuDialogVisable:false,
       multipleSelection:[],
       menuData: [
          {
          id: 1,
          label: '主页',
          children: []
          },
          {
          id: 2,
          label: '系统管理',
          children: [{
            id:3,
            label:'用户管理',
            children:[]
          },
          {
            id:4,
            label:'角色管理',
            children:[]
          },
          {
            id:5,
            label:'菜单管理',
            children:[]
          },
          {
            id:6,
            label:'文件管理',
            children:[]
          }]
          }
        ]
     }
    },
    created(){
        this.load()
    },
    methods:{
        load(){
      this.request.get("/role/page",{
        params:{
        pageNum:this.pageNum,
        pageSize:this.pageSize,
        name:this.name

      }
        }).then(res=>{
        console.log(res)
        this.tableData=res.data.records
        this.total=res.data.total 
      })
     },
     save(){
      this.request.post("/role",this.form).then(res=>{
        if(res.data){
          this.$message.success("保存成功!")
          this.dialogFormVisible=false
          this.load()
        }else{
          this.$message.error("保存失败!")
        }
      })


     },
     handleAdd(){

      this.dialogFormVisible=true
      this.form={}

     },
     handleUpdate(row){
      this.form={...row}
      this.dialogFormVisible=true
     
     },
     handleDelete(id){
      this.request.delete("/role/" + id).then(res=>{
        if(res.data){
          this.$message.success("删除成功!")
          this.load()
        }else{
          this.$message.error("删除失败!")
        }
      })
     },
     delBatch(){
      let ids=this.multipleSelection.map(v => v.id)  //把对象数组转化为id数组【1,2,3】
      this.request.post("/role/del/batch",ids).then(res=>{
        if(res.data){
          this.$message.success("批量删除成功!")
          this.load()
        }else{
          this.$message.error("批量删除失败!")
        }
      })

     },
     handleSelectionChange(val){
      this.multipleSelection=val



     },
     reset(){
      this.name=""
      this.load()

     },
    
     handleSizeChange(pageSize){
      this.pageSize=pageSize
      this.load()
     },
     handleCurrentChange(pageNum){
      this.pageNum=pageNum
      this.load()
     },
    selectMenu(roleId){
      this.menuDialogVisable=true;

    },
    handleCheckChange(data, checked, indeterminate) {
        console.log(data, checked, indeterminate);
      }
    }
}

</script>

<style>
.headerBg{
    background: #eee!important;
}
</style>
  • 基本都是复制粘贴的代码(User页面),不过要改一下请求后端接口的url,和数据对应的字段名
  1. 去注册路由 index.js
  {
        path: 'role',
        name:'角色管理',
        component: () => import('../views/Role.vue')
      },
  1. 在aside中添加角色管理 Aside.vue
  <el-menu-item index="/role">
        <i class="el-icon-s-custom"></i>
        <span slot="title">角色管理</span>
         </el-menu-item>

  1. 去页面测试

在这里插入图片描述

进行增删改查的操作测试是否可以正常操作数据库

2、实现菜单管理

  1. 建表menu表
USE `management`;
DROP TABLE IF EXISTS `menu`;

CREATE TABLE `menu` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `name` varchar(255) DEFAULT NULL COMMENT '名称',
  `path` varchar(255) DEFAULT NULL COMMENT '路径',
  `icon` varchar(255) DEFAULT NULL COMMENT '图标',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
  1. 写实体类Menu.java
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "menu")
public class Menu {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String name;
    private String path;
    private String icon;
    private String description;
}

  1. 写Mapper层MenuMapper.java
@Repository
public interface MenuMapper extends BaseMapper<Menu> {
}
  1. 写service层MenuService.java
@Service
public class MenuService extends ServiceImpl<MenuMapper, Menu> {
}
  1. 写controller层MenuController.java
@RestController
@RequestMapping("/menu")
public class MenuController {
    @Autowired
    private MenuService menuService;



    //插入和修改操作
    @PostMapping
    public Result save(@RequestBody Menu menu){
        return Result.success(menuService.saveOrUpdate(menu));
    }

    //查询所有数据
    @GetMapping
    public Result findAll(){
        return Result.success(menuService.list());
    }

    //删除
    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Integer id){
        return Result.success(menuService.removeById(id));
    }

    //批量删除
    @PostMapping ("/del/batch")
    public Result deleteBatch(@RequestBody List<Integer> ids){
        return Result.success(menuService.removeBatchByIds(ids));
    }

    //根据id查找用户信息
    @GetMapping("{id}")
    public Result findOneById(@PathVariable Integer id){
        return Result.success(menuService.getById(id));
    }

    //分页查询
    @GetMapping("/page")
    public Result findPage(@RequestParam Integer pageNum,
                           @RequestParam Integer pageSize,
                           @RequestParam String name){
        QueryWrapper<Menu> queryWrapper = new QueryWrapper<>();
        if (! "".equals(name)){
            queryWrapper.like("name",name);
        }
        queryWrapper.orderByDesc("id");
        return Result.success(menuService.page(new Page<>(pageNum,pageSize),queryWrapper));

    }
}

  1. 前端实现菜单管理页面 Menu.vue
<template>
    <div>
     <div style="padding:10px 0">
       <el-input style="width:200px" placeholder="请输入名称" suffix-icon="el-icon-search" v-model="name"></el-input>
       <el-button class="ml-5" type="primary" @click="load">搜索</el-button>
       <el-button  type="warning" @click="reset">重置</el-button>
      
     </div>

     <div style="margin:10px 0">
       <el-button type="primary" @click="handleAdd">新增<i class="el-icon-circle-plus-outline"></i></el-button>
       <el-popconfirm
                class="ml-5"
                confirm-button-text='确定'
                cancel-button-text='我再想想'
                icon="el-icon-info"
                icon-color="red"
                title="您确定要删除这些内容吗?"
                @confirm="delBatch"
          >
          <el-button type="danger"  slot="reference">批量删除<i class="el-icon-remove-outline"></i></el-button>
          </el-popconfirm>
     </div>
     <el-table :data="tableData" border stripe :header-cell-calss-name="'headerBg'"    @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55"></el-table-column>
      <el-table-column prop="id" label="ID" width="80"></el-table-column>
       <el-table-column prop="name" label="名称" ></el-table-column>
       <el-table-column prop="path" label="路径" ></el-table-column>
       <el-table-column prop="icon" label="图标" ></el-table-column>
       <el-table-column prop="description" label="描述" ></el-table-column>
       <el-table-column label="操作" width="200" align="center">
         <template slot-scope="scope" >
           <el-button type="success" @click="handleUpdate(scope.row)">编辑 <i class="el-icon-edit"></i></el-button>
          <el-popconfirm
                class="ml-5"
                confirm-button-text='确定'
                cancel-button-text='我再想想'
                icon="el-icon-info"
                icon-color="red"
                title="您确定要删除吗?"
                @confirm="handleDelete(scope.row.id)"
          >
          <el-button type="danger" slot="reference">删除<i class="el-icon-remove-outline"></i></el-button>
          </el-popconfirm>
         </template>
       </el-table-column>
     </el-table>
     <div style="padding:10px 0">
       <el-pagination
       @size-change="handleSizeChange"
       @current-change="handleCurrentChange"
         :current-page="pageNum"
         :page-sizes="[2, 4, 6, 10]"
         :page-size="pageSize"
         layout="total, sizes, prev, pager, next, jumper"
         :total="total">
       </el-pagination>
     </div>

      <el-dialog title="菜单信息" :visible.sync="dialogFormVisible" width="30%">
        <el-form label-width="80px" size="small">
          <el-form-item label="名称" >
            <el-input v-model="form.name" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="路径" >
            <el-input v-model="form.path" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="图标" >
            <el-input v-model="form.icon" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="描述" >
            <el-input v-model="form.description" autocomplete="off"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="save">确 定</el-button>
        </div>
      </el-dialog>
    </div>
</template>

<script>
export default{
    name:"User",
    data() {
     return {
       tableData:[],
       total: 0 ,
       pageNum:1,
       pageSize:4,
       name:"",
       form:{},
       dialogFormVisible:false,
       multipleSelection:[]
     }
    },
    created(){
        this.load()

    },
    methods:{
        load(){
      this.request.get("/menu/page",{
        params:{
        pageNum:this.pageNum,
        pageSize:this.pageSize,
        name:this.name

      }
        }).then(res=>{
        console.log(res)
        this.tableData=res.data.records
        this.total=res.data.total 
      })
     },
     save(){
      this.request.post("/menu",this.form).then(res=>{
        if(res.data){
          this.$message.success("保存成功!")
          this.dialogFormVisible=false
          this.load()
        }else{
          this.$message.error("保存失败!")
        }
      })


     },
     handleAdd(){

      this.dialogFormVisible=true
      this.form={}

     },
     handleUpdate(row){
      this.form={...row}
      this.dialogFormVisible=true
     
     },
     handleDelete(id){
      this.request.delete("/menu/" + id).then(res=>{
        if(res.data){
          this.$message.success("删除成功!")
          this.load()
        }else{
          this.$message.error("删除失败!")
        }
      })
     },
     delBatch(){
      let ids=this.multipleSelection.map(v => v.id)  //把对象数组转化为id数组【1,2,3】
      this.request.post("/menu/del/batch",ids).then(res=>{
        if(res.data){
          this.$message.success("批量删除成功!")
          this.load()
        }else{
          this.$message.error("批量删除失败!")
        }
      })

     },
     handleSelectionChange(val){
      this.multipleSelection=val



     },
     reset(){
      this.name=""
      this.load()

     },
    
     handleSizeChange(pageSize){
      this.pageSize=pageSize
      this.load()
     },
     handleCurrentChange(pageNum){
      this.pageNum=pageNum
      this.load()
     }

    }
}

</script>

<style>
.headerBg{
    background: #eee!important;
}
</style>
  1. 注册路由 index.js
const routes = [
  {
    path: '/',
    component: () => import('../views/Manage.vue'),
    redirect:"/home",
    children:[
      {
        path:'home',
        name:'首页',
        component:()=>import('../views/Home.vue')
      },
      {
        path: 'user',
        name:'用户管理',
        component: () => import('../views/User.vue')
      },
      {
        path: 'role',
        name:'角色管理',
        component: () => import('../views/Role.vue')
      },
      {
        path: 'menu',
        name:'菜单管理',
        component: () => import('../views/Menu.vue')
      },
     
      {
        path:'password',
        name:'修改密码',
        component:()=>import('../views/Password.vue')
      },
      {
        path:'person',
        name:'个人信息',
        component:()=>import('../views/Person.vue')
      },
      {
        path:'file',
        name:'文件管理',
        component:()=>import('../views/Files.vue')
      }
    ]
  },

都是Manage路由的子路由

  1. 去页面测试

在这里插入图片描述

同样进行以下增删改查的操作,看是否正常

创建这两个页面,主要代码都是复制粘贴前面user页面的代码,后端代码也是一样,都是实现同样的接口。所以后端建完表后就可以用代码生成器一键生成,前端代码注意修改一下请求后端的接口,然后数据库的字段要一一对应绑定好

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/139479.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

活动星投票最美空姐网络评选微信的投票方式线上免费投票

如何进行“最美空姐”的投票活动_投票小程序投票_投票助力方式大家在选择投票小程序之前&#xff0c;可以先梳理一下自己的投票评选活动是哪种类型&#xff0c;目前有匿名投票、图文投票、视频投票、赛事征集投票等。我们现在要以“最美空姐”为主题进行一次投票活动&#xff0…

Docker 三剑客

Docker 三剑客包括Docker Machine、Docker Compose、Docker Swarm。 1. Docker Machine 1.1 简介 Docker Machine 是 Docker 官方三剑客项目之一&#xff0c;使用它可以在多个平台上快速安装部署Docker环境&#xff0c;还可以在短时间内快速构建起一套Docker主机集群。 Do…

最近手头有点紧,于是用Python来冲一波股票...

文章目录前言准备工作获取数据部分爬虫的基本流程代码展示数据可视化分析最后前言 快过年了&#xff0c;手头有点紧&#xff0c;但是作为一个男人&#xff0c;身上怎么能够没有大把钞票呢&#xff1f; 于是我决定用Python来分析一波股票&#xff0c;赢了会所嫩*&#xff0c;输…

在线设计邀请函

不用ps就能制作邀请函的工具&#xff01;在线就能搞定你的邀请函设计和链接分享&#xff01;只要跟着小编下面的设计步骤&#xff0c;掌握在线工具乔拓云轻松设计在线邀请函&#xff0c;在线一键就能生成活动邀请函和邀请函链接&#xff0c;下面就跟着小编的教学开始学习如何在…

【力扣经典题目】复制带随机指针的链表,穿插链表法

题目描述&#xff1a; 给你一个长度为 n 的链表&#xff0c;每个节点包含一个额外增加的随机指针 random &#xff0c;该指针可以指向链表中的任何节点或空节点。 构造这个链表的 深拷贝。 深拷贝应该正好由 n 个 全新 节点组成&#xff0c;其中每个新节点的值都设为其对应的…

接口的理解

文章目录一、接口匿名实现类、匿名对象练习1练习2JDK8接口的新特性一、接口 1、接口使用interface定义 2、Java中接口和类是并列结构 3、如何定义接口——定义接口中的成员 JDK7之前&#xff1a;只能定义全局常量和抽象方法 全局常量&#xff1a;public static final的&#x…

力扣 2042. 检查句子中的数字是否递增

题目 句子是由若干 token 组成的一个列表&#xff0c;token 间用 单个 空格分隔&#xff0c;句子没有前导或尾随空格。每个 token 要么是一个由数字 0-9 组成的不含前导零的 正整数 &#xff0c;要么是一个由小写英文字母组成的 单词 。 示例&#xff0c;“a puppy has 2 eye…

【MySQL】-【索引】

目录为什么使用索引InnoDB中索引的推演索引前的查找设计索引简单的索引设计方案InnoDB中的索引方案为什么使用索引 一、hashmap底层使用红黑树 二、索引时在存储引擎中实现的&#xff0c;因此不同存储引擎的索引可能不同 索引的优点&#xff1a; 类似大学图书馆建书目索引&am…

zookeeper看这一篇就够了

第一章 zookeeper简介 第1节 zookeeper的由来 1 2 3 41. zookeeper最早起源于雅虎研究院的一个研究小组 2. 在雅虎内部很多大型系统基本都需要依赖一个类似的系统来进行分布式协调,并且这个系统还有单点问题 3. 雅虎的开发人员就试图开发一个通用的无单点问题的分布式协调框架…

GIS应用技巧之矢量数据编辑

挺多时候&#xff0c;需要对矢量数据进行编辑&#xff0c;那么如何编辑&#xff1f; 在ArcGIS中修改数据&#xff0c;首先要开始编辑&#xff0c;启动编辑工具条&#xff08;Editor&#xff09;。 目前编辑器处于灰色状态说明没有启动&#xff0c;那么还有些小伙伴可能在GIS主…

【项目实战】传智健康

&#x1f31f;个人博客&#xff1a;www.hellocode.top&#x1f31f; &#x1f31f;Java知识导航&#xff1a;Java-Navigate&#x1f31f; ⭐想获得更好的阅读体验请前往Java-Navigate &#x1f525;本文专栏&#xff1a;《流行框架》 &#x1f31e;如没有JavaWEB基础&#xff0…

Wireshark抓Telnet包及报文分析

Wireshark抓Telnet包及报文分析 Telnet作为应用层第二大协议&#xff0c;用途很多滴。 Telnet到底是个啥子 TELNET协议一种简单的基于文本的协议&#xff0c;它可以用来实现远程终端&#xff0c;让用户可以远程对服务器进行操作。尽管现在的远程终端基本上是基于 ssh 的了&am…

GO语言定时任务实战-gocron包

文章目录1. 基本使用1.1 初始化实例 new()1.2 添加定时任务 AddFunc()1.3 开始定时任务 Start()1.4 完整示例1.5 第一次执行定时任务的契机1.6 spec 的设置2. 粒度到秒2.1 语法示例2.2 完整示例3. 按时间间隔3.1 语法3.2 完整示例&#xff08;every&#xff09;3.3 完整示例引用…

AcWing 4721. 排队(单调栈+二分法)

问题描述 n 个小朋友排成一排&#xff0c;从左到右依次编号为 1∼n。 第 i 个小朋友的身高为 hi。 虽然队伍已经排好&#xff0c;但是小朋友们对此并不完全满意。 对于一个小朋友来说&#xff0c;如果存在其他小朋友身高比他更矮&#xff0c;却站在他右侧的情况&#xff0c…

【闲聊杂谈】纤程的概念

首先要明白几个概念&#xff1a;程序、进程、线程、纤程。 如果要非常严格的定义上来说的话&#xff0c;进程是操作系统用来做资源调度的基本单位。后来发现进程的切换是在的太费资源了&#xff0c;于是诞生了线程&#xff1b;线程多了来回切换还是很费资源&#xff0c;于是又…

[Linux]Linux项目自动化构建工具-make/Makefile

&#x1f941;作者&#xff1a; 华丞臧. &#x1f4d5;​​​​专栏&#xff1a;【LINUX】 各位读者老爷如果觉得博主写的不错&#xff0c;请诸位多多支持(点赞收藏关注)。如果有错误的地方&#xff0c;欢迎在评论区指出。 推荐一款刷题网站 &#x1f449; LeetCode刷题网站 文…

FX5U-相对定位指令DRVI(DDRVI )两种写法

该指令通过增量方式(采用相对地址的位置指定)&#xff0c;进行1速定位。 以当前停止的位置作为起点&#xff0c;指定移动方向和移动量(相对地址)进行定位动作。如果驱动触点置为ON,则输出脉冲&#xff0c;并开始从偏置速度进行加速动作。到达指令速度后&#xff0c;以指令速度进…

【LeetCode】N皇后-回溯

N皇后-回溯N皇后题目示例分析代码N皇后II题目示例分析代码总结N皇后 题目 LeetCode 51.N皇后 按照国际象棋的规则&#xff0c;皇后可以攻击与之处在同一行或同一列或同一斜线上的棋子。 n 皇后问题 研究的是如何将 n 个皇后放置在 nn 的棋盘上&#xff0c;并且使皇后彼此之间…

第二篇 - Vue 的初始化流程

一&#xff0c;前言 上篇&#xff0c;使用 rollup 完成了 Vue2 源码环境的搭建 本篇&#xff0c;介绍 Vue 的初始化流程 二&#xff0c;Vue 简介 以两个概念性问题做简单介绍 1&#xff0c;问题&#xff1a;Vue 是 MVVM 框架吗&#xff1f; 在 Vue 官网上是这样说的&#…

LeetCode450之删除二叉搜索树中的节点(相关话题:二叉搜索树,删除)

题目描述 给定一个二叉搜索树的根节点 root 和一个值 key&#xff0c;删除二叉搜索树中的 key 对应的节点&#xff0c;并保证二叉搜索树的性质不变。返回二叉搜索树&#xff08;有可能被更新&#xff09;的根节点的引用。 一般来说&#xff0c;删除节点可分为两个步骤&#x…