1、首先将neo4j导入vue中,真的会哭死这个导包就搞了我好久
<template>
</template>
<script>
import neo4j from "neo4j-driver"
export default {
name: "neo",
mounted() {
this.driver = neo4j.driver('bolt://localhost:7687', neo4j.auth.basic('neo4j', '123456'));
console.log("🚀 ~ file: AuthorArticleSearch.vue ~ line 46 ~ mounted ~ this.drive", this.driver)
},
};
</script>
<style >
</style>
2、获取数据
<template>
</template>
<script>
import neo4j from "neo4j-driver"
export default {
name: "neo",
mounted() {
var query= 'MATCH (a:Person)-[:BORN_IN]->(b:Location {city:"Boston"}) RETURN a,b'
this.executeCypher(query);
},
methods: {
/**
* 直接执行Cypher
*/
executeCypher(query) {
this.echartsNode = [] //节点数组
this.nodesRelation = [] //关系线数组
this.category = []