本文整理匯總了TypeScript中mithril.withAttr函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript withAttr函數的具體用法?TypeScript withAttr怎麽用?TypeScript withAttr使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了withAttr函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const view = function(ctrl) {
return m("div", [
m("div", [
m("input[type=text]", { oninput: m.withAttr("value", ctrl.text) }),
m("button", { onclick: ctrl.sendMessage }, "送信")
]),
m("div", [
m("ul", ctrl.messages().map(msg => // 何かimmutable js使ったら上手く行かなかったので仕方なく
m("li", msg)
))
])
]);
}
示例2: function
let SearchBarView = function (ctrl) {
return m('Label', {
'class': CLASS_TREEVIEW_SEARCH_LABEL
}, [
'Filter: ',
m('input', {
type: 'text',
name: 'treeview-search',
oninput: m.withAttr('value', ctrl.searchTerm),
value: ctrl.searchTerm()
})
])
}
示例3: m
console.assert(typeof m.version === "string");
console.assert(m.version.indexOf(".") > -1);
}
{
const vnode = m.trust("<br>");
}
{
const vnode = m.fragment({key: 123}, [m("div")]);
console.assert((vnode.children as Array<m.Vnode<any, any>>).length === 1);
console.assert(vnode.children![0].tag === 'div');
}
{
const handler = m.withAttr("value", (value) => {});
handler({currentTarget: {value: 10}});
}
{
const params = m.parseQueryString("?a=1&b=2");
const query = m.buildQueryString({a: 1, b: 2});
}
{
const root = window.document.createElement("div");
m.render(root, m("div"));
console.assert(root.childNodes.length === 1);
}
{