Explorar o código

feat: #省市区组件2

loki %!s(int64=4) %!d(string=hai) anos
pai
achega
e3a8d9063f
Modificáronse 2 ficheiros con 50 adicións e 0 borrados
  1. 50 0
      src/components/AddressSelect.vue
  2. 0 0
      src/const/region.json

+ 50 - 0
src/components/AddressSelect.vue

@@ -0,0 +1,50 @@
+<template>
+  <el-cascader
+    v-model="newValue"
+    :options="options"
+    :props="config"
+    style="width: 300px;"
+    v-bind="$attrs"
+  ></el-cascader>
+</template>
+
+<script>
+import REGION from '@/const/region.json';
+
+export default {
+  name: 'BaseBtn',
+  props: {
+    value: {
+      type: Array,
+      default: () => []
+    }
+  },
+
+  data() {
+    return {
+      newValue: this.value,
+      options: REGION,
+      config: {
+        value: 'name',
+        label: 'name'
+      }
+    };
+  },
+
+  watch: {
+    value: {
+      handler(val) {
+        this.newValue = val;
+      },
+      immediate: true
+    },
+
+    newValue(val) {
+      this.$emit('input', val);
+    }
+  },
+  methods: {}
+};
+</script>
+
+<style lang="scss" scoped></style>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
src/const/region.json


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio