You can use inline functions, but the expressions are evaluated in the context of the Vue instance. What you tried would work except that console
isn't a property of the Vue instance. But you can add the console.log
method to your component's methods if you like:
@update="()=>{ log(value) }"
methods: {
log: console.log
}
If you wanted to use the console.log
syntax explicitly like that, you'd have to add console
to data:
@update="()=>{ console.log(value) }"
data() {
return {
console: console // just `console` would work too
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…