zyfenblog

是这样的,有时候在开发的过程中,不得不使用JQ插件,但是如果直接在index.html上引入的话不仅没有生效且报错。

正确的引入方式如下:

第一步:在utlis文件下新建 jquery.js 

//jquery.js

import $ from \'jquery\';
window.$ = $;
window.jQuery = $;
export default $;

第二步:在要使用插件的页面中引入文件:

<script>
    import $ from \'./utils/jquery.js\'
    import \'./utils/jquery.Jcrop.js\'
    import qs from \'qs\';
    export default {
            ......  
        }
</script>

 

分类:

技术点:

相关文章:

  • 2021-12-01
  • 2022-03-09
  • 2021-09-22
  • 2021-11-21
  • 2021-11-21
  • 2021-06-11
  • 2021-10-24
猜你喜欢
  • 2021-11-21
  • 2021-05-26
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-11
相关资源
相似解决方案