JSFiddle - React, Tailwind, and code Playground
by nuysoft
HTML
<script src="http://g.tbcdn.cn/thx/brix-release/0.0.23/require-config.js"></script>
<div bx-name="demo/components/foo"></div>
JavaScript
define('demo/components/foo.tpl', ['mock'], function(Mock) {
return `<h1>moduleId: <%= options.moduleId %></h1>
<p>content: <%= options.content %></p>
<pre>options: <%= JSON.stringify( options, null, 4 ) %></pre>`
})
define('demo/components/foo', [
'jquery', 'underscore',
'brix/base',
'demo/components/foo.tpl'
],
function($, _, Brix, template) {
return Brix.extend({
options: {
content: 'hello'
},
init: function() {},
render: function() {
var html = _.template(template)({
options: this.options
})
$(this.element).html(html)
}
})
}
)
require(['jquery', 'brix/loader'], function($, Loader) {
$(function() {
Loader.boot()
})
})