Single Page Application Framworks for Web
Our primary goals are
- Provide a radically faster and widely accessible getting started experience for all front end.
🚀 Quick start cli
npm init simple-boot-front projectname
cd projectname
npm run bundle
npm run serve
- Installation and Getting Started
npm install simple-boot-front
View template engine (dom-render)
- https://github.com/visualkhh/dom-render
-
It's a compiler that takes your declarative components and converts them into efficient JavaScript that surgically updates the DOM.
-
Update view only for parts where the value has changed.
Module LifeCycle
- onCreate(): Sim onCreate just one call
- onInit(): module load event
- onChangedRender(): change rended in module event
- onInitedChild(): module and child module inited event
- onFinish(): lifecycle finish event
Decorator
-
@Sim(): Objects managed by the SimpleBootFront framework
- parameter: SimConfig {schema: string}
@Sim({scheme: 'index'})
@Component({
template,
styles: [css]
})
export class Index { }
-
@PostConstruct(): Methods that you run for a separate initialization operation after the object is created
@PostConstruct
post(projectService: ProjectService) {
console.log('post Construct and dependency injection')
}
-
@Injectable: No Sim Decorator Class Inject Sim
@Injectable()
export class CTitle extends Title {
constructor(public testService: TestService) {
console.log('ctitle constructor-->', this.testService)
}
cc() {
this.value = this.testService.tail(Math.floor(RandomUtils.random(1, 50)), '---');
}
@PostConstruct
ttt(testService: TestService) {
console.log('poo->', testService)
}
}
-
@After, @Before (AOP)
fire($event: MouseEvent, view: View<Element>) {
console.log('fire method')
this.data = RandomUtils.random(0, 100);
}
@Before({property: 'fire'})
before(obj: any, protoType: Function) {
console.log('before', obj, protoType)
}
@After({property: 'fire'})
after(obj: any, protoType: Function) {
console.log('after', obj, protoType)
}
-
@ExceptionHandler
@ExceptionHandler()
public exception0(e: any) {
console.log('Advice Global exception:', e)
}
Intent event broker
click() {
intentManager.publish(new Intent('layout://info/data?a=wow&aa=zzz', Math.floor(RandomUtils.random(0, 100))));
}
@Sim({scheme: 'layout'})
@Component({
template,
styles: [css]
})
export class App {
info = new AppInfo();
constructor() {}
}
export class AppInfo {
datas = 'default data';
data(i: Intent) {
this.datas = i.data + '->' + i.params.aa
}
}
Reserved key word
- html
- attribute
- router-active-class: url === href attribute => class add
- value: add and remove class name
<a router-link="ajax" router-active-class="active">Ajax</a>
<a router-link="ajax">Ajax</a>
showStore(i: Intent) {
this.datas = i.data + '->' + i.params.aa
}
call -> const data = new CustomEvent('intent', {detail: {uri: 'index://showStore', data: {id: ${it.ID}}}}); window.dispatchEvent(data);
License