大佬教程收集整理的这篇文章主要介绍了vue引入外部jquery,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我们测试使用App.vue页面
在<script>...</script>代码段中引入,放置在头部(注意import后面有一个空格)
import ‘../utils/niuniu/jquery-1.6.4.min.js‘
注意,如果不加 /* eslint-disable*/ ,那么在开启ESLint时,会报以下错误信息,加上则可以免除验证
文件完整信息如下
<template> <div id="app"> <img src="./assets/logo.png"><br/> <input type="text" name="user" id="user" value="888" /><br/> <span id="msg"></span> <!-- <router-view/> --> </div> </template> <script> /* eslint-disable*/ import ‘../utils/niuniu/jquery-1.6.4.min.js‘ import { Script } from ‘vm‘; export default { name: ‘App‘,created () { console.log($(‘#user‘)) } } $(function() { // 绑定jquery处理事件 $(‘#user‘).click(function () { $(‘#msg‘).html(‘文本框里的内容是:‘ + this.value) }) }) </script> <style> #app { font-family: ‘Avenir‘,Helvetica,Arial,sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; color: #2c3e50; margin-top: 60px; } </style>
以上是大佬教程为你收集整理的vue引入外部jquery全部内容,希望文章能够帮你解决vue引入外部jquery所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。