From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 28 五月 2025 16:48:52 +0800
Subject: [PATCH] 初始化项目

---
 components/js-select/js-select.vue |   93 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/components/js-select/js-select.vue b/components/js-select/js-select.vue
new file mode 100644
index 0000000..48bd711
--- /dev/null
+++ b/components/js-select/js-select.vue
@@ -0,0 +1,93 @@
+<template>
+  <view class="u-flex-1">
+    <u-radio-group v-model="options.value" :disabled="disabled" @change="change">
+      <u-radio v-for="(item, index) in options.items" :key="index"
+               :name="item[itemValue]">{{item[itemLabel]}}</u-radio>
+    </u-radio-group>
+  </view>
+</template>
+<script>
+/**
+ * 鍗曢�夋缁勪欢
+ * @property {Object} value 鐢ㄤ簬鍙屽悜缁戝畾閫夋嫨妗嗙殑鍊硷紝杩斿洖閫夋嫨妗嗙殑 Value
+ * @property {Boolean} disabled 鏄惁绂佺敤妯″紡锛屾槸鍚﹀彧璇绘ā寮�
+ * @property {String} dictType 瀛楀吀绫诲瀷锛屼粠瀛楀吀閲岃幏鍙栵紝鑷姩璁剧疆 items銆乮temLabel銆乮temValue
+ * @property {String} items 鍒楄〃鏁版嵁锛屽彲鎺ュ彈瀵硅薄闆嗗悎锛屽锛歔{name: '鏄�', value: '鍚�'}]
+ * @property {String} itemLabel 鎸囧畾鍒楄〃鏁版嵁涓殑浠�涔堝睘鎬у悕浣滀负 option 鐨勬爣绛惧悕锛屽 name
+ * @property {String} itemValue 鎸囧畾鍒楄〃鏁版嵁涓殑浠�涔堝睘鎬у悕浣滀负 option 鐨� value 鍊硷紝濡� value
+ * @example <js-radio v-model="model.type" dict-type="sys_yes_no"></js-radio>
+ * @description Copyright (c) 2013-Now http://jeesite.com All rights reserved.
+ * @author ThinkGem
+ * @version 2021-3-11
+ */
+export default {
+  props: {
+    value: {
+      type: String,
+      default: ''
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    },
+    dictType: {
+      type: String,
+      default: ''
+    },
+    items: {
+      type: Array,
+      default() {
+        return [];
+      }
+    },
+    itemLabel: {
+      type: String,
+      default: 'label'
+    },
+    itemValue: {
+      type: String,
+      default: 'value'
+    }
+  },
+  data() {
+    return {
+      options: {
+        value: this.value,
+        items: this.items
+      }
+    };
+  },
+  watch: {
+    value(val, oldVal) {
+      this.options.value = val;
+    },
+    items(val, oldVal){
+      this.options.items = val;
+    }
+  },
+  created() {
+    this.loadData();
+  },
+  methods: {
+    loadData(){
+      if (this.dictType != ''){
+        this.$u.api.dictData({dictType: this.dictType}).then(res => {
+          if (typeof res === 'object' && res.result === 'login'){
+            return;
+          }
+          this.options.items = res.data;
+        });
+      }else{
+        this.options.items = this.items;
+      }
+    },
+    change(val){
+      // console.log(val);
+      this.$emit('input', val);
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+
+</style>

--
Gitblit v1.9.3