Last active
December 14, 2021 02:07
-
-
Save kiichi/76583589ed2a92775ef0607f89d42157 to your computer and use it in GitHub Desktop.
Use alasql in Vue.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
export default { | |
mounted(){ | |
this.alasql("CREATE TABLE cities (city string, population number)"); | |
this.alasql("INSERT INTO cities VALUES ('Rome',2863223),('Paris',2249975),('Berlin',3517424),('Madrid',3041579)"); | |
var res = this.alasql("SELECT * FROM cities WHERE population < 3500000 ORDER BY population DESC"); | |
console.log(res); | |
} | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Other Vue.js imports etc... | |
import alasqlJs from '../node_modules/alasql/dist/alasql.min.js' | |
const alasql = { | |
install (v) { | |
Vue.prototype.alasql = alasqlJs | |
} | |
} | |
Vue.use(alasql) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment