在cshtml中使用vue的语法糖时会出错,思考是 因为@在RAZOR语法里面表示的是后台代码的开始,
在@后再加一个@表示是一个普通@ 例如<button @@click="add">+</button>
<button @@click="add">+</button>
<button v-on:click="sub">-</button>
<script type="text/javascript">
const obj = {
message: "this is a test",
name: "easyboot",
counter: 0,
image: "https://cn.bing.com/th?id=OHR.MontBlancPeak_ZH-CN0459151326_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp",
text_bg: "text-red",
firstName: "easy",
lastName: "boot"
}
const app = new Vue({
el: "#app",
data: obj,
computed: {
fullname: function () {
return this.firstName + ' ' + this.lastName;
}
},
methods: {
add() {
this.counter++;
},
add1: function () {
this.counter++;
},
sub: function () {
this.counter--;
},
},
created: function () {
console.log('created')
},
mounted: function () {
console.log('mounted')
}
})
</script>