-
v:on click
<button type="primary" v-on:click="clinkHandle(20, $event)">Button</button> => v-on = @ <button type="primary" @click="clinkHandle(20, $event)">Button</button> methods: { clickHandle(num, e) { console.log(num, e); } }
data demonstration
-
Display data in template through { {data}}
-
The label attribute passes: data-index ='data' to display data
<template>
<view>
<view>{
{msg}}</view>
<view :data-color="color">color</view>
<view>{
{person.name}}</view>
</view>
</template>
<script>
export default {
data() {
return {
msg: "this is a message",
color: "red",
person: {
name:"bill",
sex: "male"
}
}
}
}
</script>
<!--显示结果-->
this is a message
color
bill