Kaynağa Gözat

搜索结果 获取汉字json

qinpeng 2 yıl önce
ebeveyn
işleme
d97e5b0521
2 değiştirilmiş dosya ile 89 ekleme ve 1 silme
  1. 88 0
      src/views/corpus/Result.vue
  2. 1 1
      src/views/corpus/seekPage.vue

+ 88 - 0
src/views/corpus/Result.vue

@@ -0,0 +1,88 @@
+<template>
+  <div class="result" v-loading="loading">
+    <Header :projectShow="true" />
+  </div>
+</template>
+
+<script>
+//这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+//例如:import 《组件名称》from ‘《组件路径》';
+import Header from "@/components/Header";
+import { getLogin } from "@/api/api";
+import { Strockplayredline } from "@/components/corpus/Strockplayredline";
+export default {
+  //import引入的组件需要注入到对象中才能使用
+  components: {
+    Header,
+    Strockplayredline,
+  },
+  props: {},
+  data() {
+    //这里存放数据
+    return {
+      hzData: [],
+      loading: true,
+    };
+  },
+  //计算属性 类似于data概念
+  computed: {},
+  //监控data中数据变化
+  watch: {},
+  //方法集合
+  methods: {
+    // 获取汉字josn
+    gethzJSON() {
+      this.loading = true;
+      let MethodName = "hz_resource_manager-GetHZStrokesContent";
+      this.hzData.forEach((item) => {
+        let data = {
+          hz: item.con,
+        };
+        getLogin(MethodName, data)
+          .then((res) => {
+            this.$set(item.hzDetail, "hz_json", res);
+            this.loading = false;
+          })
+          .catch(() => {
+            this.loading = false;
+          });
+      });
+    },
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+    if (this.$route.query.keyword) {
+      let arr = this.$route.query.keyword.split("");
+      arr.forEach((item) => {
+        let obj = {
+          con: item,
+          hzDetail: {
+            hz_json: null,
+          },
+        };
+        this.hzData.push(obj);
+      });
+      this.gethzJSON();
+    }
+  },
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {},
+  //生命周期-创建之前
+  beforeCreated() {},
+  //生命周期-挂载之前
+  beforeMount() {},
+  //生命周期-更新之前
+  beforUpdate() {},
+  //生命周期-更新之后
+  updated() {},
+  //生命周期-销毁之前
+  beforeDestory() {},
+  //生命周期-销毁完成
+  destoryed() {},
+  //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() {},
+};
+</script>
+<style scoped>
+/* @import url(); 引入css类 */
+</style>

+ 1 - 1
src/views/corpus/seekPage.vue

@@ -52,7 +52,7 @@ export default {
         return;
       }
       this.$router.push({
-        patth: "/corpus/Result",
+        path: "/corpus/Result",
         query: {
           keyword: this.keyword,
         },