我正在尝试使用Aurelia
指南后面的TypeScript
在import {bindable, autoinject, customElement} from 'aurelia-framework';
import * as $ from 'jquery';
import 'select2';
import 'select2/css/select2.css!';
@customElement('select2')
@autoinject
export class CustomSelect{
@bindable name:string;
@bindable selected: boolean = false;
@bindable options: any;
element: Element;
constructor(element: Element){
this.element = element;
}
attached() :void {
$(this.element)
.find('select')
.select2()
.on('change', ev => {
let changeEvent;
if(window.CustomEvent){
changeEvent = new CustomEvent('change', {
detail: {
value: ev.val
},
bubbles: true
});
} else {
changeEvent = document.createEvent('CustomEvent');
changeEvent.initCustomEvent('change', true, true, {value: event.val});
}
this.element.dispatchEvent(changeEvent);
});
}
}
中编写自定义元素。
但是在尝试编译时遇到以下错误:
错误TS2339:属性' CustomEvent'类型' Window'。
上不存在错误TS2339:财产' val'类型'事件'。
上不存在
我的课程是:
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.aff.php
* Type: function
* Name: aff
* Purpose: outputs a random magic answer
* -------------------------------------------------------------
*/
function smarty_function_aff($params, &$smarty)
{
$affiliateid = $params['affiliateid'];
$refflink = 'http://example.com/aff.php?aff=' . $affiliateid .'';
print $refflink;
}
?>