一个人撸码!之vue3+vite+element-plus后台管理(标签页组件)

一个后台管理常常需要一个标签页来管理已经打开的页面,这里我们单独写一个组件来展示标签页数组。

微信截图_20231127101338.png

该标签页组件只做展示不涉及操作数据。标签页数组可记录已打开的数组,还能定义什么页面需要缓存,是一个重要的功能呢。

首先,建立一个TagList.vue组件,里面代码如下

<template>
<div 
    class="tag-list-cp-container"
    ref="TagListRef">
    <div 
        class="left"
        @wheel="handleScroll">
        <el-scrollbar 
            ref="ElScrollbarRef"
            height="100%">
            <draggable 
                class="scrollbar-container"
                item-key="sign"
                v-model="tagListTrans">
                <template #item="{element}">
                    <div
                        :class="{
                            'item':true,
                            'active':dataContainer.activeSign==element.sign,
                        }"
                        @click="handleClick(element)"
                        @contextmenu.prevent="e=>{
                            handleClickContext(e,element);
                        }">
                        <SvgIcon
                            class="sign icon-sign"
                            v-if="element.showTagIcon && element.iconName"
                            :style="'width: 15px;min-width:15px;height: 15px;'"
                            :name="element.iconName"></SvgIcon>
                        <div 
                            class="sign"
                            v-else-if="dataContainer.activeSign==element.sign">
                        </div>
                        {{element.title}}
                        <div
                            v-if="!element.fixed"
                            @click.stop="handleRemove(element)" 
                            class="bt">
                            <SvgIcon
                                :style="'width:12px;height:12px;'"
                                name="times"></SvgIcon>
                        </div>
                        <div 
                            v-if="element.isCache"
                            class="cache"></div>
                    </div>
                </template>
            </draggable>
        </el-scrollbar>
    </div>
    <div class="bt-list">
        <div 
            class="bt"
            @click="handleOptionClick(5)">
            <SvgIcon
                :style="'width:15px;height:15px;'"
                name="redo"></SvgIcon>
        </div>
        <div 
            class="bt"
            @click="handleToLeft()">
            <SvgIcon
                :style="'width:15px;height:15px;'"
                name="arrow-left"></SvgIcon>
        </div>
        <div 
            class="bt"
            @click="handleToRight()">
            <SvgIcon
                :style="'width:15px;height:15px;'"
                name="arrow-right"></SvgIcon>
        </div>
    </div>
    <div
        ref="RightOptionRef" 
        class="right">
        <div
            @click="()=>{
                dataContainer.show_1 = !dataContainer.show_1;
            }"
            class="bt">
            <SvgIcon
                :style="'width:20px;height:20px;'"
                name="icon-drag"></SvgIcon>
        </div>
        <div
            v-if="dataContainer.show_1" 
            class="bt-list-container">
            <div 
                v-if="dataContainer.tagList.length>1"
                class="item"
                @click="handleOptionClick(1)">
                <SvgIcon
                    :style="'width:16px;height:16px;color:#f86464;'"
                    name="times"></SvgIcon>
                关闭当前标签页
            </div>
            <div 
                v-if="dataContainer.tagList.length>1"
                class="item"
                @click="handleOptionClick(2)">
                <SvgIcon
                    :style="'width:16px;height:16px;color:#f86464;'"
                    name="borderverticle-fill"></SvgIcon>
                关闭其他标签页
            </div>
            <div 
                v-if="dataContainer.tagList.length>1"
                class="item"
                @click="handleOptionClick(3)">
                <SvgIcon
                    :style="'width:16px;height:16px;color:#f86464;'"
                    name="arrow-left"></SvgIcon>
                关闭左边标签页
            </div>
            <div 
                v-if="dataContainer.tagList.length>1"
                class="item"
                @click="handleOptionClick(4)">
                <SvgIcon
                    :style="'width:16px;height:16px;color:#f86464;'"
                    name="arrow-right"></SvgIcon>
                关闭右边标签页
            </div>
            <div 
                class="item re-bt"
                @click="handleOptionClick(5)">
                <SvgIcon
                    :style="'width:16px;height:16px;color:#0072E5;'"
                    name="redo"></SvgIcon>
                刷新当前标签页
            </div>
            <div 
                class="item"
                @click="handleOptionClick(6)">
                <SvgIcon
                    :style="'width:16px;height:16px;color:#0072E5;'"
                    name="expand-alt"></SvgIcon>
                视图全屏(Esc键退出)
            </div>
        </div>
    </div>
    <div 
        v-if="dataContainer.show"
        :style="{
            '--location-x':`${dataContainer.location.x || 0}px`, 
            '--location-y':`${dataContainer.location.y || 0}px`, 
        }"
        class="bt-list-container">
        <div 
            class="item"
            @click="handleSwitchCache()">
            <SvgIcon
                :style="'width:16px;height:16px;'"
                name="switch"></SvgIcon>
            切换缓存状态
        </div>
        <div 
            class="item"
            @click="handleSwitchFixed()">
            <SvgIcon
                :style="'width:16px;height:16px;'"
                name="nail"></SvgIcon>
            切换固定状态
        </div>
        <div 
            class="item re-bt"
            @click="handleRefresh()">
            <SvgIcon
                :style="'width:16px;height:16px;color:#0072E5;'"
                name="redo"></SvgIcon>
            刷新此标签页
        </div>
        <div 
            class="item"
            @click="handleOptionClick(6)">
            <SvgIcon
                :style="'width:16px;height:16px;color:#0072E5;'"
                name="expand-alt"></SvgIcon>
            视图全屏
        </div>
    </div>
</div>
</template>
<script>
/*
 * 标签切换按钮组件
 * 由外部指定数据
 */
import { 
    defineComponent,ref,reactive, 
    computed,onMounted,watch,toRef,
    onUnmounted,
    nextTick,
} from "vue";
import SvgIcon from "@/components/svgIcon/index.vue";
import draggable from 'vuedraggable';

export default {
    name: 'TagList',
    components: {
        SvgIcon,
        draggable,
    },
    props:{
        /** 
         * 所显示的标签列表
         *  */
        /**
         * 一个tag例子的属性介绍
         */
        // {
        //     title:'标签一',  //标签标题
        //     sign:'/main/index',  //唯一标识
        //     fullPath:'/main/index',  //跳转地址,完整地址
        //     isCache:true,  //该标签页面是否缓存
        //     fixed:false,  //是否固定,不可删除
        // }
        tagList:{
            type:Array,
            default:()=>{
                return [];
            },
        },
        /** 当前活动的唯一标识 */
        activeSign:{
            type:[Number,String],
            default:0,
        },
    },
    emits:[
        'onChange','onClick','onRemove','onOptionClick','onSwitchCache','onSwitchFixed',
        'onRefresh',
    ],
    setup(props,{emit}){
        const ElScrollbarRef = ref(null);
        const TagListRef = ref(null);
        const RightOptionRef = ref(null);
        const dataContainer = reactive({
            tagList:toRef(props,'tagList'),
            activeSign:toRef(props,'activeSign'),
            show:false,
            location:{},
            show_1:false,
        });
        const otherDataContainer = {
            activeItem:null,
        };
        /** 用来排序转换的数组,由外部确定是否转换 */
        const tagListTrans = computed({
            get(){
                return dataContainer.tagList;
            },
            set(value){
                emit('onChange',value);
            },
        });
        /** 标签点击事件,向外部抛出 */
        function handleClick(item){
            emit('onClick',item);
        }
        /** 标签删除事件 */
        function handleRemove(item){
            emit('onRemove',item);
        }
        /** 操作事件 */
        function handleOptionClick(type){
            emit('onOptionClick',type);
        }
        /** 
         * 鼠标滚动事件
         * 横向滚动标签页
         *  */
        function handleScroll(e){
            if(!ElScrollbarRef.value) return;
            /** shift + 鼠标滚轮可以横向滚动 */
            if(e.shiftKey) return;
            let el = ElScrollbarRef.value.wrapRef;
            let scrollLeft = el.scrollLeft;
            if(e.deltaY < 0){
                scrollLeft = scrollLeft - 30;
            }else{
                scrollLeft = scrollLeft + 30;
            }
            el.scrollLeft = scrollLeft;
        }
        /** 
         * 自动滚动到相应标签
         * 防止标签没在视区
         */
        function autoScroll(){
            nextTick(()=>{
                if(!ElScrollbarRef.value) return;
                let el = ElScrollbarRef.value.wrapRef;
                let target = el.querySelector('.item.active');
                if(!target) return;
                let rect = el.getBoundingClientRect();
                let rect_1 = target.getBoundingClientRect();
                if(rect_1.x < rect.x){
                    // 表示在左边遮挡
                    let scroll = rect.x - rect_1.x;
                    el.scrollLeft = el.scrollLeft - scroll - 5;
                }
                if((rect_1.x + rect_1.width) > (rect.x + rect.width)){
                    // 表示在右边遮挡
                    let scroll = rect_1.x - (rect.x + rect.width);
                    el.scrollLeft = el.scrollLeft + scroll + rect_1.width + 5;
                }
            });
        }
        watch(toRef(props,'activeSign'),()=>{
            autoScroll();
        });
        onMounted(()=>{
            autoScroll();
        });
        /** 鼠标右击,展示自定义右击面板 */
        function handleClickContext(e,item){
            if(!TagListRef.value) return;
            let el = TagListRef.value;
            let el_1 = e.target;
            let rect = el.getBoundingClientRect();
            let rect_1 = el_1.getBoundingClientRect();
            let location = {
                x:rect_1.x - rect.x,
                y:rect_1.y - rect.y + rect_1.height,
            };
            dataContainer.location = location;
            dataContainer.show = true;
            otherDataContainer.activeItem = item;
        }
        /** 初始化隐藏事件 */
        function initHiddenEvent(){
            function callbackFn(e){
                dataContainer.show = false;
            }
            document.addEventListener('click', callbackFn);
            onUnmounted(()=>{
                document.removeEventListener('click', callbackFn);
            });
        }
        initHiddenEvent();
        /** 
         * 切换缓存状态
         * 由外部实现
         *  */
        function handleSwitchCache(){
            if(!otherDataContainer.activeItem) return;
            emit('onSwitchCache',otherDataContainer.activeItem);
        }
        /** 
         * 切换固定状态
         * 由外部实现
         *  */
        function handleSwitchFixed(){
            if(!otherDataContainer.activeItem) return;
            emit('onSwitchFixed',otherDataContainer.activeItem);
        }
        /** 
         * 刷新标签页
         * 由外部实现
         *  */
        function handleRefresh(){
            if(!otherDataContainer.activeItem) return;
            emit('onRefresh',otherDataContainer.activeItem);
        }
        /** 跳转到右侧 */
        function handleToRight(){
            let index = dataContainer.tagList.findIndex(item=>{
                return item.sign == dataContainer.activeSign;
            });
            if(index == -1) return;
            let target = dataContainer.tagList[index + 1];
            if(!target) return;
            handleClick(target);
        }
        /** 跳转到左侧 */
        function handleToLeft(){
            let index = dataContainer.tagList.findIndex(item=>{
                return item.sign == dataContainer.activeSign;
            });
            if(index == -1) return;
            let target = dataContainer.tagList[index - 1];
            if(!target) return;
            handleClick(target);
        }
        /** 初始化隐藏事件 */
        function initHiddenEvent_1(){
            function callbackFn(e){
                if(!RightOptionRef.value) return;
                if(!e || !e.target) return;
                if(RightOptionRef.value.contains(e.target)) return;
                dataContainer.show_1 = false;
            }
            document.addEventListener('click', callbackFn);
            onUnmounted(()=>{
                document.removeEventListener('click', callbackFn);
            });
        }
        initHiddenEvent_1();
        return {
            dataContainer,
            handleClick,
            handleRemove,
            handleOptionClick,
            tagListTrans,
            handleScroll,
            ElScrollbarRef,
            handleClickContext,
            TagListRef,
            handleSwitchCache,
            handleSwitchFixed,
            handleRefresh,
            handleToRight,
            handleToLeft,
            RightOptionRef,
        };
    },
}
</script>
<style scoped lang="scss">
.tag-list-cp-container {
    height: 100%;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color);
    >.left{
        flex: 1 1 0;
        width: 0;
        height: 100%;
        :deep(.el-scrollbar__bar){
            &.is-horizontal{
                height: 5px !important;
                opacity: 0.5;
            }
        }
        :deep(.el-scrollbar__view){
            height: 100%;
        }
        :deep(.scrollbar-container){
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            align-items: center;
            width: fit-content;
            height: 100%;
            .item{
                cursor: pointer;
                display: flex;
                flex-direction: row;
                justify-content: center;
                align-items: center;
                padding: 5px 8px;
                box-sizing: border-box;
                margin-left: 5px;
                font-size: 13px;
                height: 30px;
                width: max-content;
                border-radius: 3px;
                color: #606266;
                position: relative;
                transition: all 0.2s;
                &:last-child{
                    margin-right: 5px;
                }
                &.active{
                    background-color: #5240ff30;
                    color: #5240ff;
                    font-weight: bold;
                    box-shadow: inset 0 1px 4px #00000034;
                    // border:1px solid rgb(196, 196, 196);
                }
                &:hover{
                    background-color: #5240ff30;
                    color: #5240ff;
                }
                >.sign{
                    width: 10px;
                    height: 10px;
                    border-radius: 50%;
                    background-color: #5240ff;
                    margin-right: 5px;
                    &.icon-sign{
                        background-color: transparent;
                    }
                }
                >.bt{
                    width: fit-content;
                    height: fit-content;
                    display: flex;
                    flex-direction: row;
                    justify-content: center;
                    align-items: center;
                    margin-left: 5px;
                }
                >.cache{
                    width: 30%;
                    max-width: 30px;
                    min-width: 15px;
                    height: 3px;
                    border-radius: 999px;
                    background-color: #5340ff34;
                    position: absolute;
                    bottom: 0;
                }
            }
        }
    }
    >.bt-list{
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 0 10px;
        box-sizing: border-box;
        border-left: 1px solid var(--border-color);
        box-shadow: inset 0 1px 4px #00000010;
        height: 100%;
        >*{
            margin: 0 10px 0 0;
            &:last-child{
                margin: 0;
            }
        }
        >.bt{
            cursor: pointer;
            transition: all 0.2s;
            height: 100%;
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: center;
            &:hover{
                color: #5240ff;
            }
        }
    }
    >.right{
        width: 40px;
        height: 100%;
        border-left: 1px solid var(--border-color);
        box-sizing: border-box;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        position: relative;
        box-shadow: inset 0 1px 4px #00000010;
        >.bt{
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            transition: all 0.2s;
            &:hover{
                color: #5240ff;
            }
        }
        >.bt-list-container{
            width: max-content;
            min-width: 150px;
            position: absolute;
            z-index: 9;
            top: calc(100% + 0px);
            right: 5px;
            background-color: rgb(255, 255, 255);
            box-shadow: 0 3px 8px 0 rgba(0, 0, 0, 0.5);
            padding: 10px 0;
            box-sizing: border-box;
            border-radius: 2px;
            overflow: hidden;
            transition: opacity 0.2s;
            font-size: 15px;
            >.item{
                cursor: pointer;
                width: auto;
                min-width: max-content;
                transition: all 0.2s;
                padding: 13px 15px;
                box-sizing: border-box;
                display: block;
                color: #6b7386;
                text-align: left;
                display: flex;
                flex-direction: row;
                align-items: center;
                justify-content: flex-start;
                >*{
                    margin-right: 10px;
                }
                &:hover{
                    box-shadow: inset 0 1px 4px #0000001f;
                    background-color: #fef0f0;
                    color: #f56c6c;
                }
                &.re-bt{
                    background-color: rgba(194, 224, 255, 0.5);
                    color: #0072E5;
                    &:hover{
                        background-color: rgba(194, 224, 255, 0.5);
                        color: #0072E5;
                    }
                }
            }
        }
    }
    >.bt-list-container{
        width: max-content;
        min-width: 150px;
        position: absolute;
        z-index: 9;
        top: var(--location-y);
        left: var(--location-x);
        background-color: rgb(255, 255, 255);
        box-shadow: 0 3px 8px 0 rgba(0, 0, 0, 0.5);
        padding: 10px 0;
        box-sizing: border-box;
        border-radius: 2px;
        overflow: hidden;
        opacity: 1;
        transition: opacity 0.2s;
        font-size: 15px;
        >.item{
            cursor: pointer;
            width: auto;
            min-width: max-content;
            transition: all 0.2s;
            padding: 13px 15px;
            box-sizing: border-box;
            display: block;
            color: #6b7386;
            text-align: left;
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: flex-start;
            >*{
                margin-right: 10px;
            }
            &:hover{
                box-shadow: inset 0 1px 4px #0000001f;
                background-color: #fef0f0;
                color: #f56c6c;
            }
            &.re-bt{
                background-color: rgba(194, 224, 255, 0.5);
                color: #0072E5;
                &:hover{
                    background-color: rgba(194, 224, 255, 0.5);
                    color: #0072E5;
                }
            }
        }
    }
}
</style>

这里我们使用了el-scrollbar组件来管理滚动容器,SvgIcon来管理icon的展示,vuedraggable来管理拖拽排序。

该组件接受的数据源为 tagList,activeSign。
tagList:标签的数组。
activeSign:当前活动的标签的sign字符串,每个标签是一个对象,对象有sign唯一标识属性。

组件核心思想:该组件使用外部数据源保证组件灵活性,自身集合多种操作但不处理,抛出给外部处理。只做数据的展示。

源码地址

DEMO

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

开源免费跨平台数据同步工具-Syncthing备份版本控制

Syncthing的版本控制&#xff0c;共有四种方式。 1、回收站式版本控制 设置这个控制方式后&#xff0c;删除的版本文件&#xff0c;可以保存一段时间或者永久&#xff08;0表示永久&#xff09;&#xff0c;根据配置情况。这种版本控制策略模仿了常见的“垃圾桶”方法。当文件…

树与二叉树堆:堆的意义

目录 堆的意义&#xff1a; 第一是堆的排序&#xff0c;第二是堆的top k 排行问题 堆的 top k 排行问题&#xff1a; 面对大量数据的top k 问题&#xff1a; 堆排序的实现&#xff1a;——以升序为例 方法一 交换首尾&#xff1a; 建立大堆&#xff1a; 根结点尾结点的…

set与map

set与map 一、序列式容器与关联式容器二、pair1、键值对2、作用3、构造函数4、make_pair&#xff08;1&#xff09;构造函数&#xff08;2&#xff09;作用 5、代码6、运行结果 三、set1、概念2、代码3、运行结果4、说明 四、multiset1、与set的关系2、代码3、运行结果 五、map…

SpringCloudSleuth+Zipkin 整合及关键包汇总

背景 整合了一下 SpringCloudSleuth Zipkin&#xff0c;本来是很简单的东西&#xff0c;但是最终导出依赖包时没注意&#xff0c;导致目标服务上始终没有纳入 Zipkin 的链路追踪中&#xff0c;本文记录这个过程及关键依赖包。 部署zipkin 官网下载最新的 zipkin 可执行包&a…

kafka C++实现生产者

文章目录 1 Kafka 生产者的逻辑2 Kafka 的C API2.1 RdKafka::Conf2.2 RdKafka::Message2.3 RdKafka::DeliveryReportCb2.4 RdKafka::Event2.5 RdKafka::EventCb2.6 RdKafka::PartitionerCb2.7 RdKafka::Topic2.8 RdKafka::Producer&#xff08;核心&#xff09; 3 Kafka 生产者…

合阔智云:实现API无代码开发,连接ERP系统和CRM系统提高运营效率

概述 合阔智云&#xff0c;一家成立于2011年的科技公司&#xff0c;核心业务是提供云原生和移动化设计的新一代全渠道“云端一体”履约中台和去中心化模式智能门店供应链业务中台。他们的系统可以无需API开发即可实现电商系统和客服系统的连接和集成&#xff0c;大大提高了企业…

【机器学习 | 可视化】回归可视化方案

&#x1f935;‍♂️ 个人主页: AI_magician &#x1f4e1;主页地址&#xff1a; 作者简介&#xff1a;CSDN内容合伙人&#xff0c;全栈领域优质创作者。 &#x1f468;‍&#x1f4bb;景愿&#xff1a;旨在于能和更多的热爱计算机的伙伴一起成长&#xff01;&#xff01;&…

pkpmbs 建设工程质量监督系统 文件上传漏洞复现

0x01 产品简介 pkpmbs 建设工程质量监督系统是湖南建研信息技术股份有限公司一个与工程质量检测管理系统相结合的&#xff0c;B/S架构的检测信息监管系统。 0x02 漏洞概述 pkpmbs 建设工程质量监督系统 FileUpOrDown.aspx、/Platform/System/FileUpload.ashx、接口处存在任意文…

hive里如何高效生成唯一ID

常见的方式&#xff1a; hive里最常用的方式生成唯一id&#xff0c;就是直接使用 row_number() 来进行&#xff0c;这个对于小数据量是ok的&#xff0c;但是当数据量大的时候会导致&#xff0c;数据倾斜&#xff0c;因为最后生成全局唯一id的时候&#xff0c;这个任务是放在一个…

鸿蒙4.0开发笔记之ArkTS装饰器语法基础@Extend扩展组件样式与stateStyles多态样式(十一)

一、Extend扩展组件样式 1、作用 前文提到可以使用Styles用于样式的扩展&#xff0c;在Styles的基础上&#xff0c;ArkTS语法还提供了Extend&#xff0c;⽤于扩展原生组件样式&#xff0c;包括Text、Button等等。 2、定义语法 Extend(UIComponentName) function functionNam…

Linux详解——安装JDK

目录 一、下载jdk 二、tar包安装 三、rpm包安装 一、下载jdk 1.下载jdk https://www.oracle.com/technetwork/java/javase/downloads/index.html 2.通过CRT|WinSCP工具将jdk上传到linux系统中 二、tar包安装 # 1.将JDK解压缩到指定目录 tar -zxvf jdk-8u171-linux…

配置自动化部署Jenkins和Gitea

配置自动化部署 这里使用的是JenkinsGitea 如果不知道怎么安装Jenkins和Gitea可以参考下面文章 https://blog.csdn.net/weixin_46533577/article/details/134644144 我的另一篇文章 介绍 前端 先说下自己的情况&#xff0c;因为自己服务器原因&#xff0c;使用的服务器内…

Win10系统无法登录Xbox live的四种解决方法

在Win10系统中&#xff0c;用户可以登录Xbox live平台&#xff0c;畅玩自己喜欢的游戏。但是&#xff0c;有用户却遇到了无法登录Xbox live的问题。接下来小编给大家详细介绍四种简单的解决方法&#xff0c;解决后用户在Win10电脑上就能成功登录上Xbox live平台。 Win10系统无法…

短 URL 生成器设计:百亿短 URL 怎样做到无冲突?

Java全能学习面试指南&#xff1a;https://javaxiaobear.cn 我们先来看看&#xff0c;当高并发遇到海量数据处理时的架构。在社交媒体上&#xff0c;人们经常需要分享一些 URL&#xff0c;但是有些 URL 可能会很长&#xff0c;比如&#xff1a; https://time.geekbang.org/hyb…

水离子水壁炉的科技创新与时尚家居潮流

近年来&#xff0c;水离子水壁炉作为家居装饰的新宠儿&#xff0c;正在以其独特的科技创新和时尚设计引领家居潮流。这一新型壁炉不仅注重外观美感&#xff0c;更借助先进科技实现了温馨的火焰效果&#xff0c;成为现代家居中的独特亮点。 水离子水壁炉的科技创新主要体现在其采…

【Mysql学习笔记】3 - 本章作业

1.判断 1. 这句话表示ename as name 可以不要这个as&#xff0c;同理后面的sal salary也是别名&#xff0c;而选项D的Annual Salary中间也有空格&#xff0c;程序会判断为as 但as不能连用&#xff0c;所以错误&#xff0c;选D 2.选B&#xff0c;因为null不能加上判断符号<&…

Stable Diffusion绘画系列【7】:极致东方美学

《博主简介》 小伙伴们好&#xff0c;我是阿旭。专注于人工智能AI、python、计算机视觉相关分享研究。 ✌更多学习资源&#xff0c;可关注公-仲-hao:【阿旭算法与机器学习】&#xff0c;共同学习交流~ &#x1f44d;感谢小伙伴们点赞、关注&#xff01; 《------往期经典推荐--…

leetCode 131.分割回文串 + 回溯算法 + 图解 + 笔记

131. 分割回文串 - 力扣&#xff08;LeetCode&#xff09; 给你一个字符串 s&#xff0c;请你将 s 分割成一些子串&#xff0c;使每个子串都是 回文串 。返回 s 所有可能的分割方案。回文串 是正着读和反着读都一样的字符串 示例 1&#xff1a; 输入&#xff1a;s "aa…

RabbitMQ消息模型之Work Queues

Work Queues Work Queues&#xff0c;也被称为&#xff08;Task Queues&#xff09;&#xff0c;任务模型&#xff0c;也是官网给出的第二个模型&#xff0c;使用的交换机类型是直连direct&#xff0c;也是默认的交换机类型。当消息处理比较耗时的时候&#xff0c;可能生产消息…

F. Magic Will Save the World

首先积攒了能量打了怪再积攒是没有意义的&#xff0c;可以直接积攒好&#xff0c;然后一次性进行攻击 那么怎么进行攻击了&#xff1f;可以尽量的多选怪物使用水魔法攻击剩余的再用火魔法进行攻击&#xff0c; 也就是只要存在合法的体积&#xff08;即装入背包的怪物的体积之…