Linking Vue.js in an anchor tag

Is there a way to properly link to another page using vue 2? I have a bootstrap table with rows that need to navigate to different pages. How can this be achieved? If I try to implement it like this:

<tr @click="url(forum)">data</tr>

url(forum) {
  window.location.href = '/berichten/' + forum.slug;    
}

I am unable to include another @click in the same row, as shown below:

<td @click="destroy(forum)">forum</td>

NOTE: I do not use Vue.js router.

Any assistance on this issue would be greatly appreciated.

--EDIT--

Upon clicking on the

<td @click="destroy(forum)">
, it redirects to the url(forum); function instead of executing my destroy(forum) function.

Answer №2

To prevent the click event from bubbling up to the tr, you can alter your td click declaration by adding .stop.

Here's how you can modify it:

<td @click.stop="delete(forum)">forum</td>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Merging and sorting a two-dimensional array in JavaScript

Given the following 2D array: 1230 | this is a test 1278 | my new test 1230 | test2 7654 | testing... I am looking to transform the array so that values in the first column are unique and the second column stores the concatenated text associated with eac ...

What exactly is the purpose of the colon in JavaScript's import statement?

Looking at the following example. import { QueryClientContract, TransactionClientContract } from '@ioc:Adonis/Lucid/Database' I am puzzled by the use of colons and I am unsure about where the imported files are being referenced from. ...

Click on a link to open it in the current tab with customized headers

In my Angular project, I am attempting to open a link by clicking a button that redirects to the specified URL using the following code: window.open(MY_LINK, "_self"); However, in this scenario, I also need to include an access token in the header when t ...

Can you explain the convention for boolean parameters in JavaScript or React?

Currently working with React and seeking to implement a basic setter using useState. For instance: const [isOpen, setIsOpen] = useState(false); const handleIsOpen = (value:boolean) => { setIsOpen(value) } I'm unsure about the most appropriate ...

The importance of variables in Express Routing

I'm really diving into the intricacies of Express.js routing concepts. Here's an example that I've been pondering over: const routes = require('./routes'); const user = require('./routes/user'); const app = express(); a ...

What is the best way to achieve a partial match using JQuery?

I'm experimenting with this $("ul.nav-tabs a:contains('profile')").parent().addClass("active") It does not function properly if I include Profile in the text. Is there a way to make it case insensitive? ...

Can CSS be used to automatically focus on a div element?

Can CSS be used to set autofocus on a div element? <div class="form-group" style="margin-left:10px"> <label for="organizationContainer" class="nmc-label">@Res.GroupStrings.CreateNewGroupOrganization</label> <div id="organiza ...

What is the best way to verify a user's login status in AngularJS using $routeChangeStart event?

I am new to AngularJS and I need help checking if my user is logged in or not using $routeChangeStart. Controller angular.module('crud') .controller('SigninCtrl', function ($scope,$location,User,$http) { $scope.si ...

Is there a way to verify if a button has been clicked in node.js?

I need to determine if a button has been clicked and then display a new HTML file. I am currently using the express.js app.get method to open my HTML files. Can someone please explain how I can direct a button click to open a new HTML file in the same br ...

Tips for implementing a dynamic value in the ng-style based on certain conditions

Is there a way to set a background-color conditionally using ng-style when the color value can be updated from $scope? These are the variables in my scope: $scope.someone = { id: '1', name: 'John', color: '#42a1cd' }; $scope ...

What is the best method for comparing two elements effectively in JavaScript?

Check out this code snippet that ensures txtKeyword input is focused when a key is pressed by the user. var txtKeyword = document.getElementById("txtKeyword"); ... document.addEventListener("keypress", function(event) { if(event.src ...

Tips for splitting the json_encode output in Javascript

Looking for help with extracting specific values from JSON data retrieved via PHP and AJAX. I only want to display the agent name in my ID, not the entire object that includes "name" : "Testing". Here is the console output: [{"agent_module_id":"1","agen ...

Sort by user identifier

I'm having an issue trying to filter a list of posts and comments by userId. I've passed the userId params as postCreator and commentCreator, but something seems to be amiss. Can anyone help me identify what I might be doing wrong? // Defining ...

The second tab on Bootstrap5's tab content feature seems to generate an endless amount of white

I am working on a project where I need to display statistics for both the current month and year. To organize this data, I created a card with tabs for each - one tab for the month and another for the year. By default, the month tab is loaded first. Howev ...

Obtain the model value using Yii jQuery and then proceed to submit the form

Within the _form.php view, there is a presence of $model and a CActiveForm $form. I implemented JavaScript code to compare the value of $model->publication_date with the current date. If they are identical, the form will be submitted automatically. Othe ...

JavaScript not functioning properly on mobile platform

I am encountering an issue where my JavaScript code to submit the current URL works perfectly, until I switch to a mobile screen. It seems that when I enter the mobile screen, the JavaScript functionality disappears. This issue is not limited to "mobile" o ...

Achieve a customized glow effect by blending FragColor with UnrealBloom in ThreeJS using GLSL

I am interested in implementing selective bloom for a GLTF model imported into ThreeJS using an Emission map. To accomplish this, the first step is to make objects that should not have bloom completely black. The plan includes utilizing UnrealBloomPass an ...

Load CSS stylesheet depending on Internet Explorer document mode

As I work on my website, I am facing the challenge of incorporating different versions of my style sheet based on the browser's document mode, not the browser mode. For instance, if the documentmode = ie8, I may need to load main_ie8.css, whereas for ...

Guide on retrieving the innerHTML of all <a> tags within a specific span class

<span class="mgen"> <a rel="tag">Action</a> <a rel="tag">Adventure</a> <a rel="tag">Apocalypse</a> <a rel="tag">Fantasy</a> <a rel="tag" ...

Troubleshooting NodeJS Socket.io-client connectivity issue: experiencing a lack of

I'm trying to use Socket.io-client to develop a crypto ticker. Below is the code I have been working on: var express = require("express"); var app = express(); var request = require("request") var bodyParser = require("body-parser"); var methodOverri ...