How to change the data of data in vue

var app3 = new Vue ({

el:"-sharpitem",
data:{
    item_data:[
        
    ],
},
computed:{
},
methods: {

}

});

I want to change the item_data of vue when I click. This is the data. If it can be printed, it is rendered on the page.
goods_box is li

.

li is also traversed with vue, but not the same app

li is app2

for (var j = 0; j < goods_box.length; jPP) {

goods_box[j].addEventListener("click",function(){
    item.style = "left:0;z-index:999";
    //ajax
    var daya = "{name:"550ml",img:["image/1.jpg","image/2.jpg"],p_int:"",pri:"0.99",old_pri:"99",sell:"9999",kg:"550ml",pac:"",qgp:"730",storage:"",car_img:["image/1.jpg","image/2.jpg"]}"
    var items_data = eval("("+ daya +")");

/ / app3.item_data = data;
/ / console.log (app3.item_data);

},false);
Mar.02,2021

1. Instead of using jQuery to manipulate dom binding events with vue, register events
2 with @ click in the template. There is no direct access to the data object outside the component instance of vue. Changes will not take effect because vue cannot detect changes


this can be solved by component-based application construction,

html:

<div id="box">
    <todo-item v-for="item in datas" :todo="item" :key="item.name"></todo-item>
</div>

<button onclick="fun()"></button>

js:

Vue.component('todo-item',{
    props:['todo'],
    template:'<li>{{todo.name}}</li>'
});
var app = new Vue({
    el:'-sharpbox',
    data:{
        datas:[
            {name:''}
        ]
    }
});


function fun(){
    setTimeout(function(){
        app.datas = [{name:''}]
    },500);
    app.datas = [{name:'.....'}]
}

this can be changed by events.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3ef80-447f8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3ef80-447f8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?