1. 程式人生 > >字符串反轉-vue

字符串反轉-vue

type font data utf-8 strong style lns tro function

<!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>

字符串反轉-vue