0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Vue.jsとjQueryを混在させる

Last updated at Posted at 2020-07-06

#HTML側
###CDNでvue.jsとjqueryを読み込みます

<div id="app">
  <button id="okBtn">ok</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
<script src="https://player.vimeo.com/api/player.js"></script>

#javascript側
###mountedにjqueryで処理する内容を書きます。

const vueApp = new Vue({
  el: "#app",
  data() {
    return {
      message:"hello world"
  };
  },
  mounted() {
    $('#okBtn').on('click',function(){
      alert(vueApp.message);
    })
  }
})

See the Pen abdYzXO by koji miyazaki (@donkey-maru) on CodePen.

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?