防止Vue中的事件冒泡(Prevent event bubbling in Vue)
<div id="largeArea" v-on:click="do_X"> <button>Button</button> </div>
所以我在Vue中遇到了这个问题,当我点击按钮时,我不想“do_X”触发,尽管它是largeArea的一部分。
<div id="largeArea" v-on:click="do_X"> <button>Button</button> </div>
So I have this issue in Vue where I don't want "do_X" to trigger when I click on the button, although its a part of the largeArea.
原文:https://stackoverflow.com/questions/48798216
更新时间:2022-12-05 12:12
最满意答案
相关问答
更多-
NotificationsRegistrationHandler未在iOS上调用(NotificationsRegistrationHandler is not being called on iOS)[2022-08-08]
您是否在配置文件(developer.apple.com)中检查了推送通知服务是否处于活动状态: 启用的服务:游戏中心,应用程序内购买,推送通知 I fixed, here is what I did: Updated from "U2" to "U8". Since "U8" have some OSX and XCode version requirements I updated both to the lastest versions. Now "NotificationRegistrationHa ... -
看看您的应用程序启动时是否收到以下错误。 应用程序窗口预计在应用程序启动结束时具有根视图控制器 如果是这样,修复它的方法是通过在AppDelegate.m文件中进行以下更改(尽管似乎有很多答案如何解决这个问题): // Replace [self.window addSubview:[navigationController view]]; //OLD // With [self.window setRootViewController:navigationController]; //NEW 之后 ...
-
通过向观察者注册速率keypath来解决这个问题。 [self.player addObserver:self forKeyPath:@"rate" options:0 context:nil]; - (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void*)context { if (self.player.rate == 0.0) { ...
-
iOS 7未调用supportedInterfaceOrientations(supportedInterfaceOrientations not called with iOS 7)[2023-08-31]
您应该在您的自定义NavigationController中实现这些代码。 - (NSUInteger)supportedInterfaceOrientations { if ([self.topViewController isMemberOfClass:[RootViewController class]]){ return UIInterfaceOrientationMaskPortrait; }else{ return UIInterfaceOrie ... -
我不确定applicationWillTerminate:在崩溃时被触发。 我在didFinishLaunchingWithOptions:期间调用: NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler); 然后,在你的appDelegate中,添加: void uncaughtExceptionHandler(NSException *exception) { NSLog(@"CRASH: %@", exception); NS ...
-
你的代码看起来很好。 只需确保locationManager被保留/强保持。 使用iPhone模拟器测试您的区域代码。 在“调试”菜单中,从“位置”子菜单中选择一个位置。 更改不同的位置将运用您的代码。 我刚刚使用iPhone模拟器测试了您的代码,并从子菜单中选择了位置。 我为“自定义位置”输入了代码的纬度/长数字。 这是输出: 2013-05-15 07:42:50.885 Location[69277:c07] {( (identifier home) <+37.26917400,-119.30 ...
-
大多数用户交互式应用程序(无论是移动,桌面还是网络)都使用事件驱动方法。 响应于通常由用户发起的事件而调用方法,但可能通过诸如来自网络的分组的到达或更新的GPS位置数据的可用性之类的其他动作来调用方法。 执行顺序在很大程度上取决于这些事件的顺序; 很明显,某些代码块(如应用程序初始化,比如UIViewController生命周期方法)将始终同时或以相同的顺序相互发生,但通常执行是异步的。 因此,您无法在时间方面真正说明执行的确切顺序(即,您不能说“a将在5秒后运行,然后b将在此之后运行,然后......”) ...
-
textViewShouldBeginEditing在ios 7中连续调用(textViewShouldBeginEditing called continuously in ios 7)[2022-04-07]
[textview becomeFirstResponder]; textViewShouldBeginEditing中的方法将进行循环。 它将在iOS 6中工作,但在iOS 7中需要删除。响应者将自动到相应的textview。 [textview becomeFirstResponder]; method within textViewShouldBeginEditing will take looping. It will work in iOS 6 but in iOS 7 need to remov ... -
在iOS7上调用applicationDidEnterBackground两次(applicationDidEnterBackground is called twice on iOS7)[2023-12-31]
我的测试还显示,当应用程序终止时,applicationDidEnterBackground会被调用两次。 即使是默认模板中的注释,如果应用程序支持后台执行(我测试的应用程序没有),这应该只在终止时发生,我想一个调用就足够了。 可能是一个bug,而不是iOS 7中的第一个 my testing also shows that applicationDidEnterBackground is called twice when the app is terminated. even the comments ... -
KVO通过方法调配和通知价值变化来工作。 如果您使用self访问属性,则直接访问iVar而不使用该方法。 不使用方法时,无法向观察者发送KVO通知。 您遇到的另一个问题是可变数据与不可变数据。 当您附加一个字符串时,您不会更改该对象,但您正在更改它指向的数据,这就是您没有收到任何通知的原因。 只调用了get访问器来获取字符串,然后调用了附加数据。 KVO works by method swizzling and notifying on value changes. If you access your ...