Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

问题锦集【收集iSlider使用过程中的一些问题和解决方法】 #424

Open
muzi131313 opened this issue Aug 14, 2017 · 0 comments

Comments

@muzi131313
Copy link

muzi131313 commented Aug 14, 2017

  • 1.点击事件无效,参考
    配置选项设置 fixPage:false // 不阻止原生事件,这样就可以给slider中的dom添加事件了。ps: 我自己尝试了一下,使用delagate方法,结果
mySlider.on('click', '.slider-img', function(){
console.log(arguments);
})

arguments第一个参数返回的是.slider-img选择器的dom元素,第二个是callee,第三个是一个回调。说好的,第一个是传回的是event对象呢?

  • 2.vue中使用iSlider,只好把vue当成一个ui渲染组件,然后取出html,放到data中,拼成符合islider api的数据。
let banners = [];
const vm = new Vue({
    template: `<a href="${item.link}" class="banner-img-link">
                <img class="banner-img" data-src="${item.pic}" alt="banner图">
               </a>`,
    data: { item: item }
}).$mount();

banners.push({
    content: vm.$el
});

由于使用了template,所以需要设置一个vue别名,指向dist/vue.min.js

resolve: {
    alias: {
        vue: 'vue/dist/vue.min.js'
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant