您的位置:首页 > Web前端 > Vue.js

Vue-使用JavaScript表达式

2016-12-21 13:45 204 查看

Vue-使用JavaScript表达式

<body>
<div id="app">
<h3>{{msg1}}</h3>
</div>
</body>
<script type="text/javascript">
new Vue({
el: "#app",
data:function(){
return{
msg1: "hello world"
}
}
})
</script>

输出:hello world

  • 使用replace方法
    {{msg1.replace(“world”,”张硕”)}}
    输出:hello 张硕

  • 使用split,reverse,join方法
    {{msg1.split(“”).reverse().join(“”)}}
    输出:dlrow olleh

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: