@ddwl/ddwl-ui 1.1.7 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddwl/ddwl-ui",
3
- "version": "1.1.7",
3
+ "version": "1.2.1",
4
4
  "private": false,
5
5
  "main": "src/main.js",
6
6
  "style": "lib/theme/index.css",
package/src/main.js CHANGED
@@ -16,6 +16,10 @@ import SearchTable from './packages/search-table'
16
16
  import SvgIcon from './packages/svg-icon'
17
17
  import Table from './packages/table'
18
18
  import Upload from './packages/upload'
19
+ import Select from './packages/select'
20
+ import CheckboxGroup from './packages/checkbox-group'
21
+ import RadioGroup from './packages/radio-group'
22
+
19
23
  import extendComponentInstall from './lib/install/index.js'
20
24
 
21
25
  import './lib/theme/index.css'
@@ -38,7 +42,10 @@ const components = [
38
42
  SearchTable,
39
43
  SvgIcon,
40
44
  Table,
41
- Upload
45
+ Upload,
46
+ Select,
47
+ CheckboxGroup,
48
+ RadioGroup
42
49
  ]
43
50
 
44
51
  const install = (Vue, opts = {}) => {
@@ -0,0 +1,57 @@
1
+ <!-- 多选框组 -->
2
+ <template>
3
+ <el-checkbox-group
4
+ v-model="value"
5
+ v-bind="$attrs"
6
+ v-on="$listeners"
7
+ >
8
+ <el-checkbox
9
+ v-for="item in options"
10
+ :key="item.value"
11
+ :label="item.value"
12
+ >
13
+ {{ item.label }}
14
+ </el-checkbox>
15
+ </el-checkbox-group>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: 'DCheckboxGroup',
21
+ components: {},
22
+ model: {
23
+ prop: 'modelValue',
24
+ event: 'modelChange'
25
+ },
26
+ props: {
27
+ modelValue: {
28
+ type: Array,
29
+ default: () => []
30
+ },
31
+ options: {
32
+ type: Array,
33
+ default: () => []
34
+ }
35
+ },
36
+ data () {
37
+ return {
38
+ }
39
+ },
40
+ computed: {
41
+ value: {
42
+ get () {
43
+ return this.modelValue
44
+ },
45
+ set (value) {
46
+ this.$emit('modelChange', value)
47
+ }
48
+ }
49
+ },
50
+ watch: {},
51
+ created () {},
52
+ methods: {}
53
+ }
54
+ </script>
55
+
56
+ <style lang='scss' scoped>
57
+ </style>
@@ -0,0 +1,57 @@
1
+ <!-- 单选框组 -->
2
+ <template>
3
+ <el-radio-group
4
+ v-model="value"
5
+ v-bind="$attrs"
6
+ v-on="$listeners"
7
+ >
8
+ <el-radio
9
+ v-for="item in options"
10
+ :key="item.value"
11
+ :label="item.value"
12
+ >
13
+ {{ item.label }}
14
+ </el-radio>
15
+ </el-radio-group>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: 'DRadioGroup',
21
+ components: {},
22
+ model: {
23
+ prop: 'modelValue',
24
+ event: 'modelChange'
25
+ },
26
+ props: {
27
+ modelValue: {
28
+ type: [String, Number],
29
+ default: ''
30
+ },
31
+ options: {
32
+ type: Array,
33
+ default: () => []
34
+ }
35
+ },
36
+ data () {
37
+ return {
38
+ }
39
+ },
40
+ computed: {
41
+ value: {
42
+ get () {
43
+ return this.modelValue
44
+ },
45
+ set (value) {
46
+ this.$emit('modelChange', value)
47
+ }
48
+ }
49
+ },
50
+ watch: {},
51
+ created () {},
52
+ methods: {}
53
+ }
54
+ </script>
55
+
56
+ <style lang='scss' scoped>
57
+ </style>
@@ -0,0 +1,74 @@
1
+ <!-- 下拉选择器 -->
2
+ <template>
3
+ <div>
4
+ <el-select
5
+ v-model="value"
6
+ v-bind="$attrs"
7
+ v-on="{...$listeners, change: onChange}"
8
+ >
9
+ <el-option
10
+ v-for="item in options"
11
+ :key="item.value"
12
+ :label="item.label"
13
+ :value="item.value"
14
+ />
15
+ <template slot="prefix">
16
+ <slot name="prefix" />
17
+ </template>
18
+ <template slot="empty">
19
+ <slot name="empty" />
20
+ </template>
21
+ </el-select>
22
+ </div>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ name: 'DSelect',
28
+ components: {},
29
+ model: {
30
+ prop: 'modelValue',
31
+ event: 'modelChange'
32
+ },
33
+ props: {
34
+ modelValue: {
35
+ type: [String, Number, Array],
36
+ default: ''
37
+ },
38
+ options: {
39
+ type: Array,
40
+ default: () => []
41
+ }
42
+ },
43
+ data () {
44
+ return {
45
+ }
46
+ },
47
+ computed: {
48
+ value: {
49
+ get () {
50
+ return this.modelValue
51
+ },
52
+ set (value) {
53
+ this.$emit('modelChange', value)
54
+ }
55
+ }
56
+ },
57
+ watch: {},
58
+ created () {},
59
+ methods: {
60
+ onChange (value) {
61
+ let data
62
+ if (Array.isArray(value)) {
63
+ data = this.options.filter(i => value.includes(i.value)) || []
64
+ } else {
65
+ data = this.options.find(i => value === i.value) || {}
66
+ }
67
+ this.$emit('change', value, data)
68
+ }
69
+ }
70
+ }
71
+ </script>
72
+
73
+ <style lang='scss' scoped>
74
+ </style>