Home>
I am a beginner studying various things
Thank you.
Thank you for I want to delete myself and my parent by pressing button using vue
I wanted to apply it, but it doesn't work.
// In the beginning, the following div elements are hidden
<button @ click = "deleteDom">Delete</button>
<button @ click = "addDom">Increase</button>
Press the button to increase
<button @ click = "deleteDom">Delete</button>
<button @ click = "deleteDom">Delete</button>
<button @ click = "deleteDom">Delete</button>
<button @ click = "deleteDom">Delete</button>
<Button @ click = "addDom">Increase</button>
And remove class = "dispNone" and duplicate or press the delete button (@ click = "deleteDom)
<Button @ click = "deleteDom">Delete</button>
<Button @ click = "addDom">Increase</button>
Or delete like
. dispNone {
display: none;
}
window.Vue = require ('vue');
const app = new Vue ({
el: '#app',
data: {},
methods: {
AddDom: function () {
// I want to draw a method for the button to remove the class here and increase it, but I'm not sure.
}
deleteDom: function (e) {// For deletion. I have diverted something that was referred to in previous questions.
var del = e.target.parentNode;
del.parentNode.removeChild (del);
}
}
Supplemental information (FW/tool version etc.)
I am a beginner. Please point out any missing knowledge or information.
-
Answer # 1
-
Answer # 2
I'm sorry! Almost dom processing without vue-likeness
add can be anything, but del is troublesome to let the added one inherit
Inherited from parent element
Related articles
- html - i want to narrow the space between elements of bentobox
- html - i want to arrange elements side by side
- html - when multiple pseudo elements are used in the same element
- html - after clicking on an element, i want to delete it and display the new class
- i want to delete the tag written in the textarea with html
- html - relational elements react with jquery modal
- html - in bootstrap, elements don't line up side by side
- html - overlay elements
- html - i want to eliminate the overlapping of elements
- python - i want to delete duplicate items in the query set called by django
- python 3x - about arranging duplicate elements in multiple lists
- html - the elements don't line up side by side, but go down
- html - i want to arrange elements with fixed height and width
- html - i want to arrange elements with different heights in flexbox
- i want to delete elements that do not contain specific characters in the php array
- html - elements (div) after iframe are not displayed on the browser
- html - responsive | elements overhang
- html - about duplicate title tags in wordpress
- html - elements do not line up side by side with float
- javascript - i want to delete elements under certain conditions
Related questions
- javascript : Vue.js dropdown menu
- javascript : How do I capitalize the first and last letter?
- Problem with displaying html in chrome
- html : How to create triangle animation using only CSS
- html : What to do? Button styles change on Safari IOS
- html : How do I implement this for a button?
- html : How do I set the background to be larger than the width of the parent block?
- html : How to make up a block with progress?
- JavaScript Create a form using forms, compose a search program using a data structure -an array (simple and binary search)
- html : Modal compressibility
There is yambejp's answer, so I will tell you another way to answer vue.
Vue and other frameworks feature bi-directional binding and are suitable for controlling HTML rendering in synchronization with data, so if you want to create this behavior by directly manipulating the DOM I think it ’s smarter alone.