@controller 指令将一个控件类附加到组件上。控件类必须在模块中注册。
@controller
语法
<component-name @controller="module-name:ControllerName">
以下示例演示了指令的语法。
<html> <template id="layout-template"> <webpdf> <div> <xbutton @controller="custom:MyController">Click me</xbutton> </div> <div class="fv__ui-body"> <viewer></viewer> </div> </webpdf> </template> </html> <script> UIExtension.PDFUI.module('custom', []) .controller('MyController', { handle: function() { alert('Button click!'); } }); var CustomAppearance = UIExtension.appearances.Appearance.extend({ getLayoutTemplate: function() { return document.getElementById('layout-template').innerHTML; }, disableAll: function(){} }); var libPath = window.top.location.origin + '/lib'; var pdfui = new UIExtension.PDFUI({ viewerOptions: { libPath: libPath, jr: { licenseSN: licenseSN, licenseKey: licenseKey } }, renderTo: document.body, appearance: CustomAppearance, addons: [] }); </script>
← 预配置组件 @tooltip →