简体   繁体   English

Ember.js和Twitter Bootstrap Popover

[英]Ember.js and Twitter Bootstrap Popover

I'm trying to deploy the popover using ember.js but not sure how to do it. 我试图部署酥料饼的使用ember.js但不知道如何去做。

The contents of the popover must be an element of ember to interact with it. popover的内容必须是ember的一个元素才能与之交互。

I've been watching https://github.com/jzajpt/ember-bootstrap but does not include the popover element. 我一直在看https://github.com/jzajpt/ember-bootstrap,但不包括popover元素。

Any ideas? 有任何想法吗? Thanks! 谢谢!

I think, what you try to do will never work, because if your mouse leaves the control, the popover will go away! 我想,你尝试做的事情永远不会奏效,因为如果你的鼠标离开控制器,那么弹出窗口就会消失!

App.Popover = Ember.View.extend({
     name: 'myPopover',
     template: Ember.Handlebars.compile('<div class="popover" {{bindAttr name="name"}}><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title">test</h3><div class="popover-content"><p></p></div></div></div>')         
});

App.TextField = Ember.TextField.extend({
    didInsertElement: function() {
        this._super();
        var self = this;                
        Ember.run.schedule('actions', this, function() {
           self.$().popover({
                title: 'title', 
                content: 'content',
                template: $('div[name="myPopover"]')
            });     
        });
    }
});

in the didInsertElement method of your view you can do something like this 在视图的didInsertElement方法中,您可以执行类似的操作

didInsertElement: function() {
    var self = this;
    this.$().popover({
        title: self.get('tooltipTitle'), 
        content: self.get('tooltipContent')
    });     
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM