forked from sheetjs/sheetjs
		
	VueJS 3 demo [ci skip]
This commit is contained in:
		
							parent
							
								
									7fd172f2fc
								
							
						
					
					
						commit
						4518cc8967
					
				| @ -12,8 +12,7 @@ var SJSTemplate = [ | ||||
| 		'<div id="out-table"></div>', | ||||
| 	'</div>' | ||||
| ].join(""); | ||||
| 
 | ||||
| Vue.component('html-preview', { | ||||
| var component_struct = { | ||||
| 	template: SJSTemplate, | ||||
| 	methods: { | ||||
| 		onchange: function(evt) { | ||||
| @ -59,4 +58,11 @@ Vue.component('html-preview', { | ||||
| 			XLSX.writeFile(wb, "sheetjs.xlsx"); | ||||
| 		} | ||||
| 	} | ||||
| }); | ||||
| }; | ||||
| var app; | ||||
| if(Vue.component) { | ||||
| 	Vue.component('html-preview', component_struct); | ||||
| } else { | ||||
| 	app = Vue.createApp({}); | ||||
| 	app.component('html-preview', component_struct); | ||||
| } | ||||
|  | ||||
| @ -55,7 +55,8 @@ This demo shows a sample Vue component "html-preview" that: | ||||
| </div> | ||||
| 
 | ||||
| <script lang="javascript"> | ||||
| var app = new Vue({ el: '#app' }); | ||||
| if(Vue.component) var app = new Vue({ el: '#app' }); | ||||
| else app.mount('#app'); | ||||
| </script> | ||||
| </body> | ||||
| </html> | ||||
|  | ||||
							
								
								
									
										63
									
								
								demos/vue/index3.html
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										63
									
								
								demos/vue/index3.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,63 @@ | ||||
| <!DOCTYPE html> | ||||
| <!-- xlsx.js (C) 2013-present  SheetJS http://sheetjs.com --> | ||||
| <!-- vim: set ts=2: --> | ||||
| <html> | ||||
| <head> | ||||
| 	<title>SheetJS + VueJS3</title> | ||||
| 	<!-- Vue 2 --> | ||||
| 	<script src="https://unpkg.com/vue@3.x"></script> | ||||
| 
 | ||||
| 	<!-- Various shims --> | ||||
| 	<script src="shim.js"></script> | ||||
| 
 | ||||
| 	<!-- SheetJS js-xlsx library --> | ||||
| 	<script src="xlsx.full.min.js"></script> | ||||
| 
 | ||||
| 	<!-- SheetJS Vue components --> | ||||
| 	<script src="SheetJS-vue.js"></script> | ||||
| 
 | ||||
| <style> | ||||
| .grid1 { | ||||
| 	width: 500px; | ||||
| 	height: 400px; | ||||
| }; | ||||
| </style> | ||||
| </head> | ||||
| <body> | ||||
| <pre> | ||||
| <b><a href="http://sheetjs.com">SheetJS + VueJS2 demo</a></b> | ||||
| 
 | ||||
| The core library can be used as-is in Vue applications. | ||||
| The <a href="https://github.com/sheetjs/js-xlsx">Community Edition README</a> details some common use cases. | ||||
| We also have some <a href="http://sheetjs.com/demos/">more public demos</a> | ||||
| 
 | ||||
| This demo shows a sample Vue component "html-preview" that: | ||||
| - displays a file input that accepts a spreadsheet file | ||||
| - draws the first worksheet of a submitted file as HTML | ||||
| - presents an export button to generate XLSX files | ||||
| 
 | ||||
| <a href="https://obamawhitehouse.archives.gov/sites/default/files/omb/budget/fy2014/assets/receipts.xls">Sample Spreadsheet</a> | ||||
| </pre> | ||||
| <script type="text/javascript"> | ||||
| 	var _gaq = _gaq || []; | ||||
| 	_gaq.push(['_setAccount', 'UA-36810333-1']); | ||||
| 	_gaq.push(['_trackPageview']); | ||||
| 
 | ||||
| 	(function() { | ||||
| 		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||||
| 		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||||
| 		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | ||||
| 	})(); | ||||
| </script> | ||||
| 
 | ||||
| <div id="app"> | ||||
| 	<html-preview></html-preview> | ||||
| </div> | ||||
| 
 | ||||
| <script lang="javascript"> | ||||
| if(Vue.component) var app = new Vue({ el: '#app' }); | ||||
| else app.mount('#app'); | ||||
| </script> | ||||
| </body> | ||||
| </html> | ||||
| 
 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user