本文整理匯總了TypeScript中mithril.render函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript render函數的具體用法?TypeScript render怎麽用?TypeScript render使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了render函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
const run = () => {
cells = cells === full ? empty : full;
m.render(root, [view()]);
setTimeout(run, 2000);
};
示例2: function
const run = function() {
cells = cells === full ? empty : full
m.render(root, [view()])
setTimeout(run, 2000)
}
示例3: handler
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);
}
{
const root = window.document.createElement("div");
m.mount(root, { view: () => m("div") });
console.assert(root.childNodes.length === 1);
console.assert(root.firstChild!.nodeName === "DIV");
}
{
const root = window.document.createElement("div");
m.route(root, "/a", {
"/a": { view: () => m("div") }
});
示例4: redraw
function redraw() {
m.render(mountPoint, Vnode(RouteComponent, undefined, undefined, undefined, undefined, undefined));
}
示例5: require
import { createEditor } from '../editor'
import { createPopupmenu } from '../popupmenu'
require('codemirror/addon/hint/show-hint.js')
require('codemirror/addon/search/searchcursor.js')
require('codemirror/addon/dialog/dialog.js')
require('codemirror/keymap/sublime.js')
require('codemirror/mode/sql/sql.js')
require('../../modules/sql-hint')
const pubsub = new EventEmitter()
const editor = createEditor(m, pubsub, CodeMirror)
const editorContainer = document.createElement('div')
document.body.appendChild(editorContainer)
m.render(editorContainer, editor.view())
describe('editor', () => {
it('should set value', () => {
editor.setValue('testing\nline2')
expect(editor.getValue(' ')).to.equal('testing line2')
})
it('should get the selected statement', () => {
editor.setValue('line1\nline2')
editor.setCursor({
line: 1,
ch: 0,
})
expect(editor.getCursorStatement(' ')).to.equal('line1 line2')
editor.setValue('line1\n\nline2')