add plugin support/example
This commit is contained in:
		
							parent
							
								
									8a664c07c8
								
							
						
					
					
						commit
						72bb631f81
					
				
							
								
								
									
										12
									
								
								src/main.js
								
								
								
								
							
							
						
						
									
										12
									
								
								src/main.js
								
								
								
								
							| 
						 | 
					@ -2,13 +2,23 @@ import * as riot from "riot";
 | 
				
			||||||
import app from "./components/app.riot";
 | 
					import app from "./components/app.riot";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const main = {
 | 
					const main = {
 | 
				
			||||||
 | 
					    // start-up actions here
 | 
				
			||||||
    init() {
 | 
					    init() {
 | 
				
			||||||
        // start-up actions here
 | 
					        // install plugins
 | 
				
			||||||
 | 
					        this.plugins();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // mount components
 | 
					        // mount components
 | 
				
			||||||
        this.mount();
 | 
					        this.mount();
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // extend functionality
 | 
				
			||||||
 | 
					    plugins() {
 | 
				
			||||||
 | 
					        riot.install((component) => {
 | 
				
			||||||
 | 
					            // add your own features here
 | 
				
			||||||
 | 
					            component.version = "3.0.0";
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mount() {
 | 
					    mount() {
 | 
				
			||||||
        // register core app component
 | 
					        // register core app component
 | 
				
			||||||
        riot.register("app", app);
 | 
					        riot.register("app", app);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue