jesting0
2022-04-06 4a0fb138f5670809507c6483074622630e59eef3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<template>
  <Modal :value="visible" title="网站配置" @on-visible-change="visibleChange">
    <p>
      apiUrl:
      <Input
        v-model="apiUrl"
        style="width: 360px; margin-right: 9px; margin-bottom: 3px"
      />
      <Button type="primary" size="small" @click="setConfig"
        >设置</Button
      >
    </p>
    <p>svgName:{{ svgName }}</p>
    <template #footer>
      <Button type="primary" @click="close">关闭</Button>
    </template>
  </Modal>
</template>
 
<script>
import { webConfig } from "@/utils";
export default {
  name: "DebugModal",
  model: {
    prop: "visible",
    event: "visible-change",
  },
  props: {
    visible: Boolean,
  },
  data() {
    return {
      apiUrl: webConfig.apiUrl,
      svgName: webConfig.svgName,
    };
  },
  methods: {
    visibleChange(value) {
      this.$emit("visible-change", value);
    },
    close() {
      this.$emit("visible-change", false);
    },
    setConfig() {
      window.localStorage.setItem("apiUrl", this.apiUrl);
      this.$Message.success({
        background: true,
        content: "设置成功,网页刷新后生效",
        duration: 10,
        closable: true,
      });
    },
  },
};
</script>
 
<style lang="less" scoped>
</style>