WPF中, 如何将控件的触发事件绑定到ViewModel

在DataGrid 等控件中, 有很多这种带闪电符号的触发事件. 如果用传统的事件驱动, 则直接在后台中建立 一个private PropertyChanged(Sender s, EventAgars Args) 即可. 但是如果需要绑定到ViewModel的话? 应该怎么做?
在这里插入图片描述
带闪电符号的触发事件

实现viewModel绑定前端触发事件的写法:

        <DataGridx:Name="myDataGrid"AlternationCount="2"AutoGenerateColumns="False"FontSize="24"ItemsSource="{Binding Students}"SelectedItem="{Binding SelectStudent}"SelectionMode="Extended"><i:Interaction.Triggers><i:EventTrigger EventName="SelectionChanged"><i:InvokeCommandAction Command="{Binding DataGridSelectedCommand}" CommandParameter="{Binding ElementName=myDataGrid, Path=SelectedItems}" /></i:EventTrigger></i:Interaction.Triggers><DataGrid.ColumnHeaderStyle><Style TargetType="DataGridColumnHeader"><Setter Property="BorderThickness" Value="0,0,0,3" /><Setter Property="Cursor" Value="Hand" /><Setter Property="FontWeight" Value="SemiBold" /><Setter Property="HorizontalContentAlignment" Value="Center" /><Setter Property="Margin" Value="0" /><Setter Property="MinHeight" Value="25" /><Setter Property="MinWidth" Value="0" /><Setter Property="Background" Value="#2B2C31" /><Setter Property="SnapsToDevicePixels" Value="True" /></Style></DataGrid.ColumnHeaderStyle><DataGrid.CellStyle><Style TargetType="DataGridCell"><Setter Property="HorizontalContentAlignment" Value="Center" /><Setter Property="VerticalContentAlignment" Value="Center" /><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="DataGridCell"><Grid Background="{TemplateBinding Background}"><ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /></Grid></ControlTemplate></Setter.Value></Setter></Style></DataGrid.CellStyle><DataGrid.Columns><DataGridTextColumnWidth="*"Binding="{Binding Id}"Header="Id" /><DataGridTextColumnWidth="*"Binding="{Binding Age}"Header="年龄" /><DataGridTextColumnWidth="*"Binding="{Binding Name}"Header="姓名" /><DataGridTemplateColumn Header="操作"><DataGridTemplateColumn.CellTemplate><DataTemplate><StackPanel Orientation="Horizontal"><TextBlockMargin="5"HorizontalAlignment="Right"VerticalAlignment="Center"Background="White"FontFamily="{StaticResource fontAwesome}"FontSize="24"Tag="修改"Text="&#xf14b;"><i:Interaction.Triggers><i:EventTrigger EventName="MouseUp"><i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext.DataGridUpDateCommand}" CommandParameter="{Binding}" /></i:EventTrigger></i:Interaction.Triggers><TextBlock.Style><Style TargetType="TextBlock"><Style.Triggers><Trigger Property="IsMouseOver" Value="True"><Setter Property="Cursor" Value="Hand" /><Setter Property="Foreground" Value="Orange" /></Trigger><Trigger Property="IsMouseOver" Value="False"><Setter Property="Foreground" Value="Black" /></Trigger></Style.Triggers></Style></TextBlock.Style></TextBlock><TextBlockMargin="5"HorizontalAlignment="Right"VerticalAlignment="Center"Background="White"FontFamily="{StaticResource fontAwesome}"Tag="删除"Text="&#xf056;"><i:Interaction.Triggers><i:EventTrigger EventName="MouseUp"><i:InvokeCommandAction Command="{Binding DataContext.DataGridDeleteCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}" /></i:EventTrigger></i:Interaction.Triggers><TextBlock.Style><Style TargetType="TextBlock"><Style.Triggers><Trigger Property="IsMouseOver" Value="True"><Setter Property="Cursor" Value="Hand" /><Setter Property="Foreground" Value="Red" /></Trigger><Trigger Property="IsMouseOver" Value="False"><Setter Property="Foreground" Value="Black" /></Trigger></Style.Triggers></Style></TextBlock.Style></TextBlock></StackPanel></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn></DataGrid.Columns></DataGrid>

分析核心代码:

            <i:Interaction.Triggers><i:EventTrigger EventName="SelectionChanged"><i:InvokeCommandAction Command="{Binding DataGridSelectedCommand}" CommandParameter="{Binding ElementName=myDataGrid, Path=SelectedItems}" /></i:EventTrigger></i:Interaction.Triggers>

i的命名空间 : xmlns:i=“http://schemas.microsoft.com/xaml/behaviors”

使用触发器, 事件触发器, 将前端的触发事件写在EventName中 SelectionChanged. 然后把事件绑定到后台, 将多选的Student 以CommandParameter的形式传入后端

后端代码:

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using MathNet.Numerics.Distributions;
using NavTest.Eneities;
using SqlSugar;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace NavTest.ViewModels
{public partial class Page3ViewModel:ObservableObject{[ObservableProperty]private ObservableCollection<Student> students = new();public Page3ViewModel(){for (int i = 0; i < 15; i++){Students.Add(new(){Id = i + 1,Name = $"StudentName{i}",Age = $"{i}+10",Description = $"str+{i}"});}}[RelayCommand]public void DataGridDelete(Student student){}//[RelayCommand]//public void DataGridUpDate(Student student)//{//}public RelayCommand<Student> DataGridUpDateCommand => new RelayCommand<Student>((arg) =>{});[RelayCommand]public void DataGridSelected(IList<object> objs){MyStudents = new();foreach (var item in objs){if (item is Student stu){MyStudents.Add(stu);}}Student stu1 = SelectStudent;}[RelayCommand]public void ItemControlCmd(Student student){}[ObservableProperty]private ObservableCollection<Student> myStudents = new ();[ObservableProperty]private Student selectStudent = new();}
}

完整的前端代码:

<UserControlx:Class="NavTest.Views.Page3"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:hc="https://handyorg.github.io/handycontrol"xmlns:i="http://schemas.microsoft.com/xaml/behaviors"xmlns:local="clr-namespace:NavTest.Views"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:mv="clr-namespace:NavTest.ViewModels"xmlns:sys="clr-namespace:System;assembly=mscorlib"xmlns:tt="clr-namespace:NavTest.Eneities"xmlns:vc="clr-namespace:NavTest.Components"d:DataContext="{d:DesignInstance mv:Page3ViewModel}"d:DesignHeight="450"d:DesignWidth="800"FontSize="24"mc:Ignorable="d"><Grid><Grid.ColumnDefinitions><ColumnDefinition /><ColumnDefinition /></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition /><RowDefinition /></Grid.RowDefinitions><DataGridx:Name="myDataGrid"AlternationCount="2"AutoGenerateColumns="False"FontSize="24"ItemsSource="{Binding Students}"SelectedItem="{Binding SelectStudent}"SelectionMode="Extended"><i:Interaction.Triggers><i:EventTrigger EventName="SelectionChanged"><i:InvokeCommandAction Command="{Binding DataGridSelectedCommand}" CommandParameter="{Binding ElementName=myDataGrid, Path=SelectedItems}" /></i:EventTrigger></i:Interaction.Triggers><DataGrid.ColumnHeaderStyle><Style TargetType="DataGridColumnHeader"><Setter Property="BorderThickness" Value="0,0,0,3" /><Setter Property="Cursor" Value="Hand" /><Setter Property="FontWeight" Value="SemiBold" /><Setter Property="HorizontalContentAlignment" Value="Center" /><Setter Property="Margin" Value="0" /><Setter Property="MinHeight" Value="25" /><Setter Property="MinWidth" Value="0" /><Setter Property="Background" Value="#2B2C31" /><Setter Property="SnapsToDevicePixels" Value="True" /></Style></DataGrid.ColumnHeaderStyle><DataGrid.CellStyle><Style TargetType="DataGridCell"><Setter Property="HorizontalContentAlignment" Value="Center" /><Setter Property="VerticalContentAlignment" Value="Center" /><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="DataGridCell"><Grid Background="{TemplateBinding Background}"><ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /></Grid></ControlTemplate></Setter.Value></Setter></Style></DataGrid.CellStyle><DataGrid.Columns><DataGridTextColumnWidth="*"Binding="{Binding Id}"Header="Id" /><DataGridTextColumnWidth="*"Binding="{Binding Age}"Header="年龄" /><DataGridTextColumnWidth="*"Binding="{Binding Name}"Header="姓名" /><DataGridTemplateColumn Header="操作"><DataGridTemplateColumn.CellTemplate><DataTemplate><StackPanel Orientation="Horizontal"><TextBlockMargin="5"HorizontalAlignment="Right"VerticalAlignment="Center"Background="White"FontFamily="{StaticResource fontAwesome}"FontSize="24"Tag="修改"Text="&#xf14b;"><i:Interaction.Triggers><i:EventTrigger EventName="MouseUp"><i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext.DataGridUpDateCommand}" CommandParameter="{Binding}" /></i:EventTrigger></i:Interaction.Triggers><TextBlock.Style><Style TargetType="TextBlock"><Style.Triggers><Trigger Property="IsMouseOver" Value="True"><Setter Property="Cursor" Value="Hand" /><Setter Property="Foreground" Value="Orange" /></Trigger><Trigger Property="IsMouseOver" Value="False"><Setter Property="Foreground" Value="Black" /></Trigger></Style.Triggers></Style></TextBlock.Style></TextBlock><TextBlockMargin="5"HorizontalAlignment="Right"VerticalAlignment="Center"Background="White"FontFamily="{StaticResource fontAwesome}"Tag="删除"Text="&#xf056;"><i:Interaction.Triggers><i:EventTrigger EventName="MouseUp"><i:InvokeCommandAction Command="{Binding DataContext.DataGridDeleteCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}" /></i:EventTrigger></i:Interaction.Triggers><TextBlock.Style><Style TargetType="TextBlock"><Style.Triggers><Trigger Property="IsMouseOver" Value="True"><Setter Property="Cursor" Value="Hand" /><Setter Property="Foreground" Value="Red" /></Trigger><Trigger Property="IsMouseOver" Value="False"><Setter Property="Foreground" Value="Black" /></Trigger></Style.Triggers></Style></TextBlock.Style></TextBlock></StackPanel></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn></DataGrid.Columns></DataGrid><WrapPanelGrid.Row="1"HorizontalAlignment="Center"VerticalAlignment="Center"Orientation="Horizontal"><TextBlockMargin="5,5,5,5"Foreground="White"Text="测试1" /><TextBlockMargin="5,5,5,5"Foreground="White"Text="测试2" /><TextBlockMargin="5,5,5,5"Foreground="White"Text="测试3" /><TextBlockMargin="5,5,5,5"Foreground="White"Text="测试4" /><TextBlockMargin="5,5,5,5"Foreground="White"Text="测试5" /><TextBlockMargin="5,5,5,5"Foreground="White"Text="测试6" /></WrapPanel><Grid Grid.Row="1" Grid.Column="1"><ItemsControl AlternationCount="2" ItemsSource="{Binding MyStudents}"><ItemsControl.ItemsPanel><ItemsPanelTemplate><WrapPanel /></ItemsPanelTemplate></ItemsControl.ItemsPanel><ItemsControl.ItemTemplate><DataTemplate><Border x:Name="border" Padding="2"><StackPanel><TextBlock Foreground="White" Text="{Binding Name}" /><TextBlock Foreground="White" Text="{Binding Age}" /><ButtonCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext.ItemControlCmdCommand}"CommandParameter="{Binding}"Content="{Binding Description}"Foreground="White" /></StackPanel></Border><DataTemplate.Triggers><Trigger Property="ItemsControl.AlternationIndex" Value="1"><Setter TargetName="border" Property="Background" Value="red" /></Trigger></DataTemplate.Triggers></DataTemplate></ItemsControl.ItemTemplate></ItemsControl></Grid></Grid>
</UserControl>

如果在一个有ItemSource的控件内找不到 后台的Property 和command, 可以尝试 binding ElementName 和binding Relationsource

例如command 可以 binding Relationsource = {RelationSource AncestorType = window} path = datacontext. xxxcommand
commandparameter={binding} 返回单个class为数据源

CommandParameter=“{Binding ElementName=myDataGrid, Path=SelectedItems}” 绑定别的控件上的属性 或者 用child的方式

一些补充的内容:

除了BooleanToVisibilityConverter之外,WPF框架还提供了许多其他的内置转换器。以下是一些常用的系统现有转换器的示例:BooleanToVisibilityConverter: 将bool值转换为Visibility枚举值。
InverseBooleanConverter: 反转bool值,将true转换为false,将false转换为true。
StringFormatConverter: 格式化字符串,可以将值与指定的格式字符串进行组合。
DateTimeConverter: 将DateTime对象转换为不同格式的字符串,或者将字符串转换为DateTime对象。
BrushConverter: 将字符串表示的颜色转换为Brush对象。
ValueConverterGroup: 将多个转换器组合成一个组,按照顺序依次进行转换。
EnumToStringConverter: 将枚举值转换为对应的字符串表示。
NumericUpDownConverter: 用于增加和减少数值类型的转换器。
CollectionViewSource: 用于在集合和视图之间进行转换和筛选。
这只是一些常见的示例,WPF框架提供了更多的内置转换器,可以满足各种转换需求。你可以根据具体的场景和需求选择合适的转换器来使用。eventTrriger
DataTrigger常用触发器:CallMethodAction
ChangePropertyAction
InvokeCommandActionCallMethodAction 和 InvokeCommandAction 是在 WPF 中用于触发操作的两种不同方式,它们有一些区别,并且在特定的情况下可能不可互相替代。CallMethodAction:CallMethodAction 允许你直接调用指定的方法。你可以通过设置 TargetObject 属性指定要调用方法的对象,并使用 MethodName 属性指定要调用的方法名称。这种方式适用于简单的、特定于 UI 的操作,例如在按钮点击或其他事件发生时执行某个方法。它可以方便地将事件触发与方法调用关联起来,但缺点是它与 UI 逻辑紧耦合,并且无法利用 WPF 中的命令系统。InvokeCommandAction:InvokeCommandAction 允许你通过绑定一个命令来执行操作。你可以使用 Command 属性绑定到一个实现了 ICommand 接口的命令对象。当触发与行为关联的事件时,命令的 Execute 方法将被调用,而命令的 CanExecute 方法决定是否可以执行。这种方式更符合 MVVM 架构和解耦原则,它将 UI 逻辑与业务逻辑分离,并提供了更好的可测试性和可重用性。虽然 CallMethodAction 和 InvokeCommandAction 实现了类似的功能,但在大多数情况下,推荐使用 InvokeCommandAction 和命令模式来处理用户交互。它更符合 MVVM 设计模式的理念,并且提供了更好的灵活性和可扩展性。但在一些简单的场景下,CallMethodAction 也可以作为一种快速临时解决方案。因此,根据具体的需求和架构设计,你可以选择使用 CallMethodAction 或 InvokeCommandAction 来触发操作。在 WPF 中,CallMethodAction 是一种交互行为(Interaction Behavior),它允许你通过 XAML 触发调用特定方法。它是 System.Windows.Interactivity 命名空间下的一个类,需要通过添加对 System.Windows.Interactivity 程序集的引用才能使用。CallMethodAction 可以用于任何具有无参数的方法。它与事件触发器(EventTrigger)一起使用,当特定事件发生时,将触发并调用绑定的方法。以下是使用 CallMethodAction 的示例:CallMethodAction :===============<StackPanel><Button Content="Click Me"><i:Interaction.Triggers><i:EventTrigger EventName="Click"><i:CallMethodAction TargetObject="{Binding}" MethodName="HandleButtonClick" /></i:EventTrigger></i:Interaction.Triggers></Button>
</StackPanel>关闭窗口,用到window的close方法:<ButtonBackground="Red"Content="&#xe653;"Style="{StaticResource ControlButtonStyle}"ToolTip="Close"><i:Interaction.Triggers><i:EventTrigger EventName="Click"><i:CallMethodAction MethodName="Close" TargetObject="{Binding RelativeSource={RelativeSource AncestorType=Window}}" /></i:EventTrigger></i:Interaction.Triggers></Button>ChangePropertyAction=============
例如:TargetObject="{Binding} 返回了DataContext,就是ViewModel,它的PropertyName就是里面的属性IsMarker<i:Interaction.Triggers><i:EventTrigger EventName="Loaded"><i:ChangePropertyAction PropertyName="IsMarker" Value="True" TargetObject="{Binding}"/></i:EventTrigger><i:EventTrigger EventName="Closing"><i:ChangePropertyAction PropertyName="IsMarker" Value="False" TargetObject="{Binding}"/></i:EventTrigger></i:Interaction.Triggers>最小化,用到window的Minimized属性:<ButtonBackground="#22FFFFFF"Content="&#xe7e6;"Style="{StaticResource ControlButtonStyle}"ToolTip="Minimize"><i:Interaction.Triggers><i:EventTrigger EventName="Click"><i:ChangePropertyActionPropertyName="WindowState"TargetObject="{Binding RelativeSource={RelativeSource AncestorType=Window}}"Value="Minimized" /></i:EventTrigger></i:Interaction.Triggers></Button><Button Content="Change Background"><i:Interaction.Triggers><i:EventTrigger EventName="Click"><i:ChangePropertyAction TargetObject="{Binding ElementName=MyBorder}"PropertyName="Background"Value="Red" /></i:EventTrigger></i:Interaction.Triggers>
</Button>
<Border x:Name="MyBorder" Width="100" Height="100" Background="Green" /><Button Content="Change Background"><i:Interaction.Triggers><i:EventTrigger EventName="Click"><i:ChangePropertyAction TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"PropertyName="Background"Value="Red" /></i:EventTrigger></i:Interaction.Triggers>
</Button>=============<RadioButtonWidth="200"Height="50"Content="连接PLC"FontSize="18"Foreground="White"Style="{DynamicResource RadioButtonMenuStyle}"Tag="&#xf11c;"><i:Interaction.Triggers><i:EventTrigger EventName="Checked"><i:InvokeCommandAction Command="{Binding ConnCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=RadioButton}}" /></i:EventTrigger></i:Interaction.Triggers></RadioButton>============在 <i:EventTrigger> 元素中,可以使用不同的 EventName 属性来指定常见事件的名称,以触发相应的动作或触发器。以下是一些常用的 EventName 值示例:Loaded:当元素加载完成时触发。
Unloaded:当元素卸载时触发。
MouseEnter:当鼠标指针进入元素时触发。
MouseLeave:当鼠标指针离开元素时触发。
MouseDown:当鼠标按下按钮时触发。
MouseUp:当鼠标释放按钮时触发。
Click:当元素被点击时触发。
Checked:当复选框或单选按钮的选中状态改变时触发。
TextChanged:当文本框的文本内容改变时触发。
PreviewMouseMove:鼠标在元素上移动。
PreviewMouseUp:鼠标释放按钮。
MouseEnter:鼠标进入元素。
MouseLeave:鼠标离开元素。
PreviewMouseWheel:滚动鼠标滚轮。
键盘事件:PreviewKeyDown:按下键盘上的键。
PreviewKeyUp:释放键盘上的键。
KeyDown:按下键盘上的键(冒泡事件)。
KeyUp:释放键盘上的键(冒泡事件)。SelectionChanged:当下拉列表、列表框或其他选择控件的选择项发生改变时触发。
这只是一些常见的 EventName 值示例,实际上,可以根据具体的控件和需求,选择适合的事件名称。根据控件的类型和事件的定义,可以在相关文档或控件的事件文档中找到更多可用的 EventName 值。<Button Content="Toggle Size" Width="100" Height="30"><i:Interaction.Triggers><i:EventTrigger EventName="Click"><i:Interaction.Behaviors><ei:ChangePropertyAction TargetObject="{Binding RelativeSource={RelativeSource AncestorType=Window}}"PropertyName="WindowState"><ei:ChangePropertyAction.Value><System:WindowState><System:WindowState x:FactoryMethod="FromValue"><System:WindowState.Normal /><System:WindowState.Maximized /></System:WindowState></System:WindowState></ei:ChangePropertyAction.Value></ei:ChangePropertyAction></i:Interaction.Behaviors></i:EventTrigger></i:Interaction.Triggers>
</Button>========i:DataTrigger========{Binding RelativeSource  = {RelativeSource Self} 
{Binding RelativeSource = {RelativeSource  AncestorType=Button}}  {Binding ElementName=TestTBlock, Path=Name}<Button Content="Click Me"><i:Interaction.Triggers><i:DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path = IsMouseOver}" Value="False"><i:ChangePropertyAction TargetObject="{Binding RelativeSource={RelativeSource Self}}"PropertyName="BackGround"Value="Red" /></i:DataTrigger></i:Interaction.Triggers>
</Button>

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

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

相关文章

Unity实现设计模式——解释器模式

Unity实现设计模式——解释器模式 解释器模式&#xff08;Interpreter Pattern&#xff09;是一种按照规定语法进行解析的模式&#xff0c;现实项目中用得较少。 给定一门语言&#xff0c;定义它的文法的一种表示&#xff0c;并定义一个解释器&#xff0c;该解释器使用该表示来…

python读取vivo手机截图,将满屏图片文件移动别的路径

问题之初 python读取vivo手机截图&#xff0c; 将满屏图片文件移动别的路径好多这样的图片&#xff0c;占用手机大量的内存&#xff0c;食之无味弃之可惜&#xff01;那么会复制粘贴&#x1f440;代码的我们我们今天就把这些图片筛选清理掉。 这段代码 原有逻辑的基础上&…

【C++设计模式之原型模式:创建型】分析及示例

简介 原型模式&#xff08;Prototype Pattern&#xff09;是一种创建型设计模式&#xff0c;它允许通过复制已有对象来生成新的对象&#xff0c;而无需再次使用构造函数。 描述 原型模式通过复制现有对象来创建新的对象&#xff0c;而无需显式地调用构造函数或暴露对象的创建…

Fiddle日常运用手册(3)-对移动端产品进行数据接口抓包

一般如果在做安卓移动端产品测试的时候&#xff0c;一般不像WEB端产品&#xff0c;可以直接进行F12进行接口日志查看开发预留的打印信息&#xff0c;将会影响测试人员的问题定位精准度以及效率。 这里&#xff0c;我们就介绍一下使用Fiddle进行移动端产品的抓包教程。 一、pc端…

JavaAPI---replace

package daysreplace;public class ReplaceTest {public static void main(String[] args) {String str "wwxhhhhhhhhhhh333";System.out.println("替换前的字符串" str);String newstr str.replace("333", "111");System.out.prin…

CRMEB商城源码开源标准版v5.2.0+后端+前端uni-app开源包安装教程

CRMEB打通版是一款全开源支持商用的PHP多语言商城系统,历经年时间匠心之作&#xff01;系统采用前后端分离技术&#xff0c;基于TP6Uui-app框架开发&#xff1b;客户移动端采用uni-app开发&#xff0c;管理后台前端使用iviewUI开发。系统支持微信公众号端、微信小程序端、H5端、…

10链表-单链表构造LinkedList

目录 LeetCode之路——707. 设计链表 分析&#xff1a; Code&#xff1a; LeetCode之路——707. 设计链表 你可以选择使用单链表或者双链表&#xff0c;设计并实现自己的链表。 单链表中的节点应该具备两个属性&#xff1a;val 和 next 。val 是当前节点的值&#xff0c;n…

@SpringBootApplication剖析

一、前言 在SpringBoot项目中启动类必须加一个注解SpringBootApplication&#xff0c;今天我们来剖析SpringBootApplication这个注解到底做了些什么。 二、SpringBootApplication简单分析 进入SpringBootApplication源代码如下&#xff1a; 可以看出SpringBootApplication是…

el-date-picker增加默认值 修改样式

预期效果 默认是这样的 但希望是直接有一个默认的当天日期&#xff0c;并且字体颜色啥的样式也要修改&#xff08;在这里假设今天是2023/10/6 功能实现 踩了坑挺多坑的&#xff0c;特此记录 官方文档 按照官方的说明&#xff0c;给v-model绑定一个字符串就可以了 在j…

关联规则挖掘(下):数据分析 | 数据挖掘 | 十大算法之一

⭐️⭐️⭐️⭐️⭐️欢迎来到我的博客⭐️⭐️⭐️⭐️⭐️ &#x1f434;作者&#xff1a;秋无之地 &#x1f434;简介&#xff1a;CSDN爬虫、后端、大数据领域创作者。目前从事python爬虫、后端和大数据等相关工作&#xff0c;主要擅长领域有&#xff1a;爬虫、后端、大数据…

uniapp 实现地图头像上的水波纹效果

最近实现了uniapp 地图头像水波纹的效果&#xff0c;话不多说&#xff0c;先来看看视频效果吧&#xff1a;链接 在这里具体的代码就不放出来了&#xff0c;还是利用了uniapp的 uni.createAnimation 方法&#xff0c;因为cover-view 不支持一些css 的动画效果&#xff0c;所以这…

文举论金:非农到来!黄金原油全面走势分析策略独家指导

市场没有绝对&#xff0c;涨跌没有定势&#xff0c;所以&#xff0c;对市场行情的涨跌平衡判断就是你的制胜法宝。欲望&#xff01;有句意大利谚语&#xff1a;让金钱成为我们忠心耿耿的仆人&#xff0c;否则&#xff0c;它就会成为一个专横跋扈的主人。空头&#xff0c;多头都…

24 mysql all 查询

前言 这里主要是 探究一下 explain $sql 中各个 type 诸如 const, ref, range, index, all 的查询的影响, 以及一个初步的效率的判断 这里会调试源码来看一下 各个类型的查询 需要 lookUp 的记录 以及 相关的差异 此系列文章建议从 mysql const 查询 开始看 测试表结构…

基于可解释性特征矩阵与稀疏采样全局特征组合的人体行为识别

论文还未发表&#xff0c;不细说&#xff0c;欢迎讨论。 Title: A New Solution to Skeleton-Based Human Action Recognition via the combination usage of explainable feature extraction and sparse sampling global features. Abstract: With the development of deep …

集群服务器

文章目录 项目名:实现集群服务器技术栈通过这项目你学到(或者复习到)实现功能编码环境json环境muduo库boost库MySql数据库登录mysql&#xff1a;查看mysql服务开启了没有&#xff1f;mysql的服务器及开发包库chat&#xff0c;表 allgroup friend groupuser offlinemessage user…

记录本地部署Stable-diffusion所依赖的repositories和一些插件

今天按照其他文章的步骤拉取好了https://github.com/AUTOMATIC1111/stable-diffusion-webui后&#xff0c;点击webui-user.bat后发现&#xff0c;repositories和models还得慢慢拉取&#xff0c;好吧&#xff0c;GitHub Desktop&#xff0c;启动&#xff01; BLIP: https://git…

vuejs中使用axios时如何追加数据

前言 在vuejs中使用axios时&#xff0c;有时候需要追加数据,比如,移动端下拉触底加载,分页加载,滑动滚动条,等等,这时候就需要追加数据了,下面我们来演示下. 代码演示 <template><div><div><el-button type"primary" click"handleBtnGetJ…

【设计模式】访问者模式

文章目录 1.访问者模式定义2.访问者模式的角色3.访问者模式实战案例3.1.场景说明3.2.UML类图3.3.代码实现 4.访问者模式优缺点5.访问者模式适用场景6.访问者模式总结 主页传送门&#xff1a;&#x1f481; 传送 1.访问者模式定义 访问者模式&#xff08;Visitor Pattern&#x…

cartographer-(0)-ubuntu(20.04)-环境安装

1.安装 ROS wiki.ros.org 1.1修改镜像源&#xff1a; 到网站上找与操作系统相匹配的镜像源 ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror # 默认注释了源码镜像以提高 apt update 速度&#xff0c;如有需要可自行取消注释 deb htt…

JavaScript系列从入门到精通系列第十六篇:JavaScript使用函数作为属性以及枚举对象中的属性

文章目录 前言 1&#xff1a;对象属性可以是函数 2&#xff1a;对象属性函数被称为方法 一&#xff1a;枚举对象中的属性 1&#xff1a;for...in 枚举对象中的属性 前言 1&#xff1a;对象属性可以是函数 对象的属性值可以是任何的数据类型&#xff0c;也可以是函数。 v…