<!DOCTYPE html><html xmlns:v-on="http://www.w3.org/1999/xhtml"><head> <meta charset="utf-8"> <title>Vue测试实例 - 菜鸟教程(runoob.com)</title> <script src="../js/vue.min.js"></script></head><body><div id="app"> <button v-on:click="m">字符串反转</button> <p>{{message}}</p> </div><script> new Vue({ el:‘#app‘, data:{ message:"abc" }, methods:{ m: function () { this.message = this.message.split(‘‘).reverse().join(‘‘) } } })</script> </body></html>
时间: 2024-10-09 05:09:48