字符串反转-vue
2017-08-10 16:17 笨笨03 阅读(1031) 评论(0) 编辑 收藏 举报<!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>