Aurelia Custom Element - 从DOM中删除之后的任何内容

时间:2016-06-29 08:45:57

标签: aurelia-binding

我有Aurelia的最新版本,虽然我相信它已于去年修复(https://github.com/aurelia/framework/issues/35),但我仍有问题。还有其他人有这个问题吗?

自定义元素:

<template>
    <i class="fa fa-question fa-sm"></i>
</template>

import {customElement, bindable, inject, bindingMode} from 'aurelia-framework';

@customElement('tooltiphelper')
@bindable({name: 'title',       attribute: 'title',     defaultValue: 'Helper text',    defaultBindingMode: bindingMode.twoWay})
@inject(Element)
export class ToolTipHelper {

    constructor(element) {
        this.element = element;
    }

    bind() 
    {
        $(this.element).tooltip( { title: this.title, placement: 'right' } );
    } 
}

参考地点:

<template>    
<div class="row">
    <div class="col-sm-12">
        <div class="form-group">
            <label class="control-label">Name</label>
            <tooltiphelper title.bind="'Do you work?'" />
            <input disabled.bind="readonly" type="text" class="form-control" value.bind="baseContent.Name">
        </div>
    </div>
</div>
</template>

HTML生成:输入在哪里?

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

CE需要正确关闭。

<template>    
<div class="row">
    <div class="col-sm-12">
        <div class="form-group">
            <label class="control-label">Name</label>
            <tooltiphelper title.bind="'Do you work?'"></tooltiphelper>
            <input disabled.bind="readonly" type="text" class="form-control" value.bind="baseContent.Name">
        </div>
    </div>
</div>
</template>