Startinga basic frontend application.
This commit is contained in:
parent
523197902f
commit
dda9cf2fe2
@ -1923,12 +1923,40 @@ var require_mithril = __commonJS((exports, module) => {
|
||||
});
|
||||
|
||||
// src/index.ts
|
||||
var import_mithril2 = __toESM(require_mithril(), 1);
|
||||
|
||||
// src/components/UserList.ts
|
||||
var import_mithril = __toESM(require_mithril(), 1);
|
||||
|
||||
// src/models/User.ts
|
||||
class User {
|
||||
username;
|
||||
constructor(username) {
|
||||
this.username = username;
|
||||
}
|
||||
getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
}
|
||||
|
||||
// src/components/UserList.ts
|
||||
var users = [
|
||||
new User("U1"),
|
||||
new User("U2"),
|
||||
new User("U3")
|
||||
];
|
||||
var oninit = function() {
|
||||
};
|
||||
var view = function() {
|
||||
return import_mithril.default(".UserList", import_mithril.default("ul", users.map((u) => import_mithril.default("li", u.getUsername()))));
|
||||
};
|
||||
var UserList = { oninit, view };
|
||||
var UserList_default = UserList;
|
||||
|
||||
// src/index.ts
|
||||
var App = {
|
||||
view: function() {
|
||||
return import_mithril.default("body", [
|
||||
import_mithril.default("div", "Hello!")
|
||||
]);
|
||||
return import_mithril2.default("body", [UserList_default]);
|
||||
}
|
||||
};
|
||||
import_mithril.default.mount(document.body, App);
|
||||
import_mithril2.default.mount(document.body, App);
|
||||
|
@ -7,12 +7,15 @@ const users: User[] = [
|
||||
new User('U3')
|
||||
];
|
||||
|
||||
export default const UserList = {
|
||||
getList: function () {
|
||||
return users.map(u => m('li', u.getUsername()));
|
||||
},
|
||||
|
||||
view: function () {
|
||||
return m('li', { id: 'UserList' }, this.getList());
|
||||
}
|
||||
const oninit = function () {
|
||||
// get the users value
|
||||
};
|
||||
|
||||
const view = function () {
|
||||
return m('.UserList',
|
||||
m('ul', users.map(u => m('li', u.getUsername())))
|
||||
);
|
||||
}
|
||||
|
||||
const UserList = { oninit, view };
|
||||
export default UserList;
|
||||
|
@ -3,9 +3,7 @@ import UserList from './components/UserList';
|
||||
|
||||
const App = {
|
||||
view: function() {
|
||||
return m('body', [
|
||||
UserList
|
||||
]);
|
||||
return m('body', [ UserList ]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user