【发布时间】:2019-05-17 19:34:27
【问题描述】:
我正在将行为组件从 Polymer 1.x 转换为 Polymer 3.x。我关心的是如何翻译我的 bevaior 类以在 Polymer 3 应用程序中使用。测试代码如下:
PermissionsBehaviour =
{
ready: function ()
{
var _th = this;
this._getRoles().then(function (d)
{
_th.set('perms_roles', d);
});
},
properties:
{
perms_roles: { type: Array, value: [] },
},
_getRoles: function ()
{
return $.get(Global.Settings.RootWebUrl +
"Permission/GetUserRoles", function (result) { });
}
}
【问题讨论】:
-
可以通过使用 mixins 来做到这一点:
标签: polymer polymer-2.x polymer-3.x