iT邦幫忙

2017 iT 邦幫忙鐵人賽
DAY 6
1
Modern Web

Vue.JS且戰且飛系列 第 6

Vue.JS且戰且飛(六)

methods(function概念)

jsfiddle


<html>
<head>
    <meta charset="utf-8">
    <title>methods(function概念)</title>
</head>
<body>
<div id="show">
    <p>{{ name }}</p>
    <input type="button" value="變大寫吧" v-on:click="bigString()">
</div>
</body>
<script src="vue.js"></script>
<script>
    new Vue({
        el: '#show',
        data: {
            name: 'eagle'
        },
        methods: {
            bigString: function () {
                this.name = this.name.toUpperCase();
            }
        }
    })
</script>
</html>


上一篇
Vue.JS且戰且飛(五)
下一篇
Vue.JS且戰且飛(七)
系列文
Vue.JS且戰且飛30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言