我会动态地在页面中添加一些"Li"标签.
每个"Li"都有这样的代码:
<li id="file-1000">
<a target="_blank" href="pack.jpg" style="display: block;" class="pirobox_gall first last">
<img alt="" src="pack_thumb.jpg" class="attached">
<i style="display: none;" class="icon-close2" id="delIcon-1000"></i>
</a>
</li>
Run Code Online (Sandbox Code Playgroud)
结果:

事件:
1)我将一些事件绑定到"a"和"i"标签,如下所示:
$(document)
.on('mouseenter',
'#file-1000',
function () {
$('#delIcon-1000').fadeIn(200);
})
.on('mouseleave',
'#file-1000',
function () {
$('#delIcon-1000').fadeOut(200);
})
.on('click',
'#delIcon-1000',
function () {
alert('Close btn is clicked');
});
Run Code Online (Sandbox Code Playgroud)
2)另一方面,"a"标签在其点击事件上有其他指定的事件(通过jQuery图像幻灯片插件:piroBox)
因此,当我点击图像时,我看到一个很好的弹出我的图像(作为一张大图),但当我点击删除按钮时,我看到大图像+"点击关闭btn"消息"在一起.
当我单击"删除"按钮时(当我单击它的子项时),我想要阻止"a"标记单击事件(父事件).
我知道使用stopPropagation()是一个解决方案,但它在这里不起作用,我不知道如何在$(document).on(....)方法中使用它.
编辑:
我尝试了一些答案,但他们失败了,结果是这样的:

黑框上面是>>一个弹出框,用于显示更大的图片(我想防止打开这个框架)
我需要创建一个Property在我的用户控件的一个Model类型,但我想我必须避免直接进入到Model Layer从View Layer.
我有一个View Model的Model是提供一套我的模型对象 ...
我需要一个属性在我的用户控件中这样:
public A_Model SelectedA { get; set; }
Run Code Online (Sandbox Code Playgroud)
一种方法是创建一个新的View Model类似下面的代码,并在我的使用它User Control:
// ------------ View Model Layer ------------
public class SingleA_ViewModel: ModelA
{
}
// --------------- View Layer ---------------
public SingleA_ViewModel SelectedA { get; set; }
Run Code Online (Sandbox Code Playgroud)
但我试图阻止一个新的空视图模型类继承上面的模型.这是对的吗?
你有什么建议阻止直接访问Model layer和创建Property我的User Control???
编辑1:
我有3个项目:
我想知道我能阻止参考Model …
系统信息:
Server Win Server 2012
Web Server: IIS 8.5
Project platform: ASP.NET MVC
Webhook Path: https://webhook.MYDOMAIN.com/api/webhookaction
// I use my domain name instead of MYDOMAIN
Run Code Online (Sandbox Code Playgroud)
我使用以下方法创建了用于Telegram Webhook的自签名证书,但最后电报向我返回 SSL 错误,您知道更简单的成功方法吗?
A)
我通过以下命令而不是通配符 SSL创建了一个自签名证书OpenSSL
openssl req -newkey rsa:2048 -sha256 -nodes -keyout MyDomain_private_key.key -x509 -days 365 -out MyDomain_public.pem -subj "/C=US/ST=New York/L=MyDomain/O=MyDomain/CN=webhook.MyDomain.com"
Run Code Online (Sandbox Code Playgroud)
B)
然后我PFX通过这个命令从输出文件创建了一个:
openssl pkcs12 -export -out MyDomain.pfx -inkey MyDomain_private.key -in MyDomain_public.pem -certfile MyDomain_public.pem
Run Code Online (Sandbox Code Playgroud)
C)
然后我MyDomain.pfx在服务器上安装了并将其绑定到Https://webhook.mydomain.com.
d)
此外,我使用的MyDomain_public.pem文件中的 …
我有一个这样的控制器:
@ApiBearerAuth()
@UseGuards(AuthGuard('jwt'))
@ApiTags('books')
@Controller('books')
export class BooksController {
@Post()
async create(@Body() createBookVm: CreateBookVm) {
//........
}
@Get()
async all() {
//........
}
}
Run Code Online (Sandbox Code Playgroud)
当我在没有 accessToken 的情况下访问all()上述控制器中的 rout 时,出现以下错误:
{"statusCode":401,"error":"Unauthorized"}
Run Code Online (Sandbox Code Playgroud)
这是正确的行为,但我想忽略控制器all()一般的操作。@UseGuards我想在未经授权的情况下将其作为公共路线访问。
我有以下实体:
public class Notification
{
public int Id { get; set; }
public string Title { get; set; }
public Guid RefId { get; set; }
public Object Ref { get; set; } // << The navigation property: Sometime its type is Poll and sometime is Test, maybe I add other types too
public NotifTypes Type { get; set; }
}
public enum NotifTypes
{
Poll=1,
Test=2,
// Other NotifTypes here
}
//-------------------------------------------------------------------
public class Test
{
public int Id …Run Code Online (Sandbox Code Playgroud) 我在Controller Action下创建了一个nopCommerce v3.5 plugin并且想要在下一个请求中重用它.load a text file_cacheManager
_cacheManager总是回复NULL我的要求Key.这是我的代码的一部分:
public class AbcController : Controller
{
private readonly ICacheManager _cacheManager;
public AbcController(ICacheManager cacheManager)
{
this._cacheManager = cacheManager;
}
public ActionResult Test(string title,string titleLink, string backColor, string textColor, string timeColor)
{
try
{
// myText is always NULL here >> :(
var myText = _cacheManager.Get<string>("myText");
if (string.IsNullOrEmpty(jsText))
{
string path = HttpContext.Server.MapPath("~/plugins/Misc.Test/App_Data/text.txt");
myText = System.IO.File.ReadAllText(path);
// Fill cacheManager >>
_cacheManager.Set("myText", myText, int.MaxValue); …Run Code Online (Sandbox Code Playgroud) 我想防止基于绑定到Static成员或...在我的WPF Window.
这个窗口包括很多UserControl,element并且有一些static资源。我知道我应该unbind使用bindingstoStatic类来防止一些内存泄漏,我知道这种情况unbinding:
BindingOperations.ClearAllBindings(....);
BindingOperations.ClearBinding(...., ....);
Element.ItemsSource= null;
Run Code Online (Sandbox Code Playgroud)
但我的问题是:
您是否知道或推荐任何自动 Unbind系统(一些类和代码作为一种机制来解除所有元素的绑定以在需要时调用它)在我们想要关闭窗口时使用它以确保没有对任何元素的任何绑定Window或它UserControls和他们elements和任何sub-elements???
我正在寻找一种在窗口关闭事件中使用的安全方法...
这是我的控制器操作方法
public ActionResult ChangeStateId(int userId,int stateId)
{
return RedirectToAction("Index")
}
Run Code Online (Sandbox Code Playgroud)
在我的视图锚标记中,我想使用这样的参数值重定向到上面的操作方法
<a href="'@Url.Action("ChangeStateId","User")?userId='+$('#hidID').val()+ '&stateId=' +$('#hidStateId'.val()")></a>;
Run Code Online (Sandbox Code Playgroud)
但这对我不起作用。
我有一个flutter应用程序,需要一个条形图,我可以在其中单击条形图来打开包含相关信息的新页面。我该怎么做呢?

/// Bar chart example
charts.BarChart(
createSampleData(),
animate: true,
barGroupingType: charts.BarGroupingType.stacked,
barRendererDecorator:
new charts.BarLabelDecorator<String>(),
domainAxis: new charts.OrdinalAxisSpec(),
),
Run Code Online (Sandbox Code Playgroud) 我想将Windows的主音量绑定到程序中的滑块.所以我搜索并找到了一些方法GET或SET掌握了音量+一些像这样的库:
在某些地方,我看到一个带有LOOP的代码来获取音量值:循环
编辑:
现在我有以下课程.我创建了它的一个实例,并使用propertychange事件通过Trace.WriteLine显示音量.但是,当我更改Windows音量时,它会导致无错误的错误!
public class AudioEndpointVolumeEnforcer : INotifyPropertyChanged
{
private MMDeviceEnumerator mmDeviceEnumerator;
private MMDevice mmDevice;
private AudioEndpointVolume audioEndpointVolume;
private bool _deviceIsMuted;
private int _desiredVolume;
private int _volumePercent;
public AudioEndpointVolumeEnforcer()
{
try
{
mmDeviceEnumerator = new MMDeviceEnumerator();
mmDevice = mmDeviceEnumerator.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
audioEndpointVolume = mmDevice.AudioEndpointVolume;
audioEndpointVolume.OnVolumeNotification += data =>
{
VolumePercent = Convert.ToInt16(data.MasterVolume*100);
_deviceIsMuted = data.Muted;
};
DesiredVolume = 65;
}
catch (Exception ex)
{ …Run Code Online (Sandbox Code Playgroud) A)
我有一个 DLL 库,其中包含一个类,如下所示:
public class Thing
{
// OTHER_PROPERTIES
//..........................
[JsonProperty(Required = Required.Always)]
public bool IsBook { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
假设:我无法访问该类的源代码
Thing。
二)
我有一个像这样的 JSON:
{
OTHER_PROPERTIES
}
Run Code Online (Sandbox Code Playgroud)
注意:它没有一对名称/值
IsBook假设:我不会更改
JSON包含IsBook在其中的内容。
C)
如果我运行,JsonConvert.DeserializeObject<Thing>(json);则会出现以下错误:
错误:在 json 中找不到所需的属性 ....
如何通过观察问题的假设来编写自定义代码来解决上述错误?(在写下你的答案之前,请再次阅读上述假设。)
我jwt在我的nestjs应用程序中使用令牌,但是当我运行我的项目并使用@UseGuards(AuthGuard())装饰器调用控制器时,应用程序调试返回以下错误:
Cannot read property 'challenge' of undefined
Run Code Online (Sandbox Code Playgroud) c# ×6
wpf ×3
nestjs ×2
asp.net-mvc ×1
audio ×1
bar-chart ×1
caching ×1
charts ×1
code-first ×1
data-binding ×1
flutter ×1
hidden-field ×1
html ×1
jquery ×1
json.net ×1
jwt ×1
memory-leaks ×1
mvvm ×1
nopcommerce ×1
self-signed ×1
ssl ×1
telegram ×1
unbind ×1
url.action ×1
webhooks ×1