码迷,mamicode.com
首页 > Web开发 > 详细

VUE中使用jquery

时间:2020-07-24 19:06:10      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:ted   UNC   ges   from   tick   func   bsp   dex   vue   

 

 

首先要配置JQUERY使用

例,给文章详情图片添加缩略图

 

基于vant ui的 ImagePreview插件

 

import Vue from "vue";
import { ImagePreview } from ‘vant‘;
// 全局注册
Vue.use(ImagePreview);

export default {
  mounted(){
    this.$nextTick(function () {
        // 绑定图片缩略图
        $(‘.blog-content‘).on(‘click‘,‘img‘,function(){
          ImagePreview({
            images:[
              $(this).attr(‘src‘)
            ],
            showIndex:false
          });
        })
     })
  }
};

 

 

VUE中使用jquery

标签:ted   UNC   ges   from   tick   func   bsp   dex   vue   

原文地址:https://www.cnblogs.com/miangao/p/13373179.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!