qtsk-vue3 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- import Button from './components/Button/index.vue'
1
+ import CommonButton from './components/Button/index.vue'
2
2
  import Container from './components/Container/index.vue'
3
3
  import Menu from './components/Menu/index.vue'
4
4
  import Icons from './components/Icons/index.vue'
@@ -12,10 +12,11 @@ import Tree from './components/Tree/index.vue'
12
12
  import Dialog from './components/Dialog/index.vue'
13
13
  import Form from './components/Form/index.vue'
14
14
  import FormItem from './components/FormItem/index.vue'
15
+ import Empty from './components/Empty/index.vue'
15
16
 
16
17
  const components =
17
18
  [
18
- Button,
19
+ CommonButton,
19
20
  Container,
20
21
  Menu,
21
22
  Icons,
@@ -28,6 +29,7 @@ const components =
28
29
  Tree,
29
30
  Dialog,
30
31
  Form,
31
- FormItem
32
+ FormItem,
33
+ Empty
32
34
  ]
33
35
  export default components
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div :class="[type === 'default' ? 'defaultClass' : 'normalClass']">
3
- <el-button :type="type" :color="color" :link="link">
2
+ <div class="normalClass">
3
+ <el-button :type="type" :color="color" :link="link" :loading="loading">
4
4
  <slot>按钮</slot>
5
5
  </el-button>
6
6
  </div>
@@ -11,35 +11,32 @@ import { ElButton} from 'element-plus'
11
11
  import '../../style/root.css'
12
12
 
13
13
  defineOptions({
14
- name: 'Button',
14
+ name: 'CommonButton',
15
15
  })
16
- const props = defineProps({
16
+ defineProps({
17
17
  type:{
18
18
  type: String,
19
19
  default: 'default', //可选数值有, primary/default
20
20
  },
21
21
  color: {
22
22
  type: String,
23
- default: '#4d4398'
23
+ default: ''
24
24
  },
25
25
  link: {
26
26
  type: Boolean,
27
27
  default: false
28
+ },
29
+ loading: {
30
+ type: Boolean,
31
+ default: false
28
32
  }
29
33
  })
30
34
  //根据不同的类型,自定义按钮颜色
31
- const color = props.type === 'primary' ? props.color : ''
35
+ // const color = props.type === 'primary' ? props.color : ''
32
36
  </script>
33
37
 
34
38
  <style lang="less" scoped>
35
39
  .normalClass{
36
40
  margin: 0 10px;
37
41
  }
38
- .defaultClass{
39
- margin: 0 10px;
40
- :deep(.el-button){
41
- color: var(--qt-main-color)!important;
42
- border-color: var(--qt-main-color)!important;
43
- }
44
- }
45
42
  </style>
@@ -38,6 +38,7 @@ defineOptions({
38
38
  .el-header{
39
39
  display: flex;
40
40
  align-items: center;
41
+ justify-content: space-between;
41
42
  height: 60px;
42
43
  }
43
44
  .el-aside, .el-main{
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <el-config-provider :locale="zhCn">
3
- <el-date-picker v-model="modelValue" type="date" :placeholder="placeholder" :format="format" :value-format="format"/>
3
+ <el-date-picker style="width: 100%;" v-model="modelValue" type="date" :placeholder="placeholder" :format="format" :value-format="format"/>
4
4
  </el-config-provider>
5
5
  </template>
6
6
 
@@ -23,7 +23,8 @@ const props = defineProps({
23
23
  },
24
24
  })
25
25
 
26
- const modelValue = defineModel('modelValue', { type: Boolean })
26
+ const modelValue = defineModel('modelValue', { type: String })
27
27
  </script>
28
28
 
29
- <style lang="less" scoped></style>
29
+ <style lang="less" scoped>
30
+ </style>
@@ -38,14 +38,14 @@ defineProps({
38
38
  })
39
39
 
40
40
  let modelValue = defineModel('modelValue', {type: Boolean})
41
-
41
+ let emits = defineEmits(['confirm'])
42
42
  // 点击取消
43
43
  const handleCancel = () => {
44
44
  modelValue.value = false
45
45
  }
46
46
  // 点击确认
47
47
  const handleConfirm = () => {
48
- modelValue.value = false
48
+ emits('confirm')
49
49
  }
50
50
  </script>
51
51
 
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <el-empty :description="description" />
3
+ </template>
4
+
5
+ <script setup>
6
+ import { ElEmpty} from 'element-plus'
7
+
8
+ defineOptions({
9
+ name: 'Empty',
10
+ })
11
+ defineProps({
12
+ description:{
13
+ type: String,
14
+ default: '敬请期待',
15
+ }
16
+ })
17
+ </script>
18
+
19
+ <style lang="less" scoped>
20
+ </style>
@@ -13,6 +13,7 @@
13
13
  </template>
14
14
 
15
15
  <script setup>
16
+ import { ref } from 'vue'
16
17
  import { ElForm } from 'element-plus'
17
18
 
18
19
  defineOptions({
@@ -21,8 +22,8 @@ defineOptions({
21
22
 
22
23
  defineProps({
23
24
  rules: {
24
- type: Array,
25
- default: () => ([])
25
+ type: Object,
26
+ default: () => ({})
26
27
  },
27
28
  inline: {
28
29
  type: Boolean,
@@ -31,6 +32,17 @@ defineProps({
31
32
  })
32
33
 
33
34
  let formData = defineModel('formData', {type: Object})
35
+ let ruleFormRef = ref(null)
36
+
37
+ const resetForm = () => {
38
+ if (!ruleFormRef.value) return
39
+ ruleFormRef.value.resetFields()
40
+ }
41
+
42
+ defineExpose({
43
+ resetForm,
44
+ ruleFormRef
45
+ })
34
46
 
35
47
  </script>
36
48
 
@@ -1,5 +1,14 @@
1
1
  <template>
2
- <ElInput :type="type" :placeholder="placeholder" v-model="inputValue" v-bind="$attrs"/>
2
+ <ElInput :type="type" :placeholder="placeholder" v-model="inputValue" v-bind="$attrs">
3
+ <template #prepend v-if="$slots.prepend">
4
+ <!-- 前缀 -->
5
+ <slot name="prepend" />
6
+ </template>
7
+ <template #append v-if="$slots.append">
8
+ <!-- 后缀 -->
9
+ <slot name="append" />
10
+ </template>
11
+ </ElInput>
3
12
  </template>
4
13
 
5
14
  <script setup>
@@ -24,6 +33,6 @@ const inputValue = defineModel('modelValue', {default: '',type: [String, Number]
24
33
 
25
34
  <style lang="less" scoped>
26
35
  :deep(.el-textarea__inner:focus), :deep(.el-input__wrapper.is-focus){
27
- box-shadow: 0 0 0 1px var(--qt-main-color) inset;
36
+ box-shadow: 0 0 0 1px var(--main-color) inset;
28
37
  }
29
38
  </style>
@@ -1,5 +1,11 @@
1
1
  <template>
2
- <el-select v-model="selectValue" :placeholder="placeholder" v-bind="$attrs" :teleported="false">
2
+ <el-select
3
+ v-model="selectValue"
4
+ :placeholder="placeholder"
5
+ v-bind="$attrs"
6
+ :teleported="false"
7
+ clearable
8
+ >
3
9
  <el-option v-for="item in options" :key="item[valueName]" :label="item[keyName]" :value="item[valueName]" />
4
10
  </el-select>
5
11
  </template>
@@ -7,14 +7,15 @@
7
7
  :width="column.width"
8
8
  :fixed="column.fixed"
9
9
  :key="index"
10
+ :show-overflow-tooltip="column.width?true:false"
10
11
  >
11
12
  <template #default="scope">
12
- <div v-if="column.key!=='operations'">
13
+ <template v-if="column.key!=='operations'">
13
14
  {{ scope.row[column.key] }}
14
- </div>
15
- <div v-else>
15
+ </template>
16
+ <template v-else>
16
17
  <slot name="operations" :data="scope.row" :index="scope.$index"/>
17
- </div>
18
+ </template>
18
19
  </template>
19
20
  </el-table-column>
20
21
  <template #empty>
@@ -1,14 +1,15 @@
1
1
  <template>
2
2
  <el-tree
3
3
  ref="treeRef"
4
- style="max-width: 600px"
4
+ style="max-width: 600px;padding-top: 4px;"
5
5
  :data="data"
6
6
  :props="defaultProps"
7
7
  :show-checkbox="showCheckBox"
8
8
  default-expand-all
9
9
  :node-key="nodeKey"
10
10
  :expand-on-click-node="false"
11
- @node-click="handleNodeClick"
11
+ @node-click="handleNodeClick"
12
+ @check-change="checkChange"
12
13
  />
13
14
  </template>
14
15
 
@@ -17,6 +18,8 @@ import { ref } from 'vue'
17
18
  import { ElTree } from 'element-plus'
18
19
 
19
20
  const treeRef = ref(null)
21
+ const modelValue = defineModel('modelValue', { type: Array })
22
+
20
23
  defineOptions({
21
24
  name: 'Tree',
22
25
  })
@@ -50,6 +53,12 @@ const defaultProps = {
50
53
  const getCheckedKeys = () => {
51
54
  console.log(treeRef.value.getCheckedKeys(false))
52
55
  }
56
+
57
+ //当复选框被点击的时候触发, 用于获取所有的选中数据
58
+ const checkChange = () => {
59
+ modelValue.value = treeRef.value.getCheckedKeys(false)
60
+ }
61
+
53
62
  defineExpose({
54
63
  getCheckedKeys
55
64
  })
@@ -1,5 +1,5 @@
1
1
  import Components from './component'
2
- import { QTMessage, QTMessageBox } from './components/Message'
2
+ import { Message, MessageBox } from './components/Message'
3
3
 
4
4
  const makeInstaller = (components = [], directives = []) => {
5
5
  const apps = []
@@ -17,6 +17,6 @@ const makeInstaller = (components = [], directives = []) => {
17
17
 
18
18
  const install = makeInstaller(Components)
19
19
 
20
- export { QTMessage, QTMessageBox, install, install as default }
20
+ export { Message, MessageBox, install, install as default }
21
21
 
22
- console.info('%c====== Editing in local package ======', 'font-size:16px;color:green;')
22
+ console.info('%c====== Editing in local package ======', 'font-size:16px;color:pink;')
package/package/index.js CHANGED
@@ -19,7 +19,4 @@ const install = makeInstaller(Components)
19
19
 
20
20
  export { Message, MessageBox, install, install as default }
21
21
 
22
- console.info('%c====== Editing in local package ======', 'font-size:16px;color:green;')
23
-
24
-
25
- console.info('%c====== Editing in local package ======', 'font-size:16px;color:yellow;')
22
+ console.info('%c====== Editing in local package ======', 'font-size:16px;color:pink;')
@@ -1,5 +1,5 @@
1
1
  /* 标准化样式定义 */
2
2
  :root{
3
3
  --main-color: #4d4398;
4
- --main-background-color: #e0edff;
5
- }
4
+ --main-background-color: #e0edff
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qtsk-vue3",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "vue3版组件库",
5
5
  "main": "./package/index.js",
6
6
  "scripts": {