widget.qw 1.0.47 → 1.0.49

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.
@@ -17071,10 +17071,15 @@ const _sfc_main$o = {
17071
17071
  isDisabled
17072
17072
  } = util.props2auth(props);
17073
17073
  const modelValue = useVModel(props, "modelValue", emit);
17074
- const formatTime = (time) => {
17075
- let res = time;
17076
- return res;
17077
- };
17074
+ const formatTime = computed({
17075
+ get() {
17076
+ let res = props.modelValue;
17077
+ return res;
17078
+ },
17079
+ set() {
17080
+ modelValue.value = "";
17081
+ }
17082
+ });
17078
17083
  watch(() => props.modelValue, (n, o) => {
17079
17084
  if (!props.defaultnow)
17080
17085
  return;
@@ -17094,20 +17099,19 @@ const _sfc_main$o = {
17094
17099
  const _component_van_field = resolveComponent("van-field");
17095
17100
  return openBlock(), createElementBlock(Fragment, null, [!unref(isGone) ? (openBlock(), createBlock(_component_van_field, {
17096
17101
  key: 0,
17097
- modelValue: props.modelValue,
17098
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => props.modelValue = $event),
17102
+ modelValue: unref(formatTime),
17103
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(formatTime) ? formatTime.value = $event : null),
17099
17104
  name: "datetimePicker",
17100
17105
  label: props.label,
17106
+ disabled: unref(isDisabled),
17107
+ readonly: unref(isReadonly),
17108
+ clearable: "",
17101
17109
  placeholder: props.placeholder,
17102
- readonly: "",
17103
17110
  required: unref(isRequired),
17104
17111
  rules: props.rules,
17105
- "is-link": unref(isReadonly) ? false : true,
17106
- onClick: onToggleShow
17107
- }, {
17108
- input: withCtx(() => [createTextVNode(toDisplayString(formatTime(props.modelValue)), 1)]),
17109
- _: 1
17110
- }, 8, ["modelValue", "label", "placeholder", "required", "rules", "is-link"])) : createCommentVNode("", true), createVNode(_sfc_main$p, {
17112
+ "right-icon": "arrow",
17113
+ onClickRightIcon: onToggleShow
17114
+ }, null, 8, ["modelValue", "label", "disabled", "readonly", "placeholder", "required", "rules"])) : createCommentVNode("", true), createVNode(_sfc_main$p, {
17111
17115
  isShow: data2.isShow,
17112
17116
  "onUpdate:isShow": _cache[1] || (_cache[1] = ($event) => data2.isShow = $event),
17113
17117
  modelValue: unref(modelValue),
@@ -17074,10 +17074,15 @@ var __async = (__this, __arguments, generator) => {
17074
17074
  isDisabled
17075
17075
  } = util.props2auth(props);
17076
17076
  const modelValue = useVModel(props, "modelValue", emit);
17077
- const formatTime = (time) => {
17078
- let res = time;
17079
- return res;
17080
- };
17077
+ const formatTime = vue.computed({
17078
+ get() {
17079
+ let res = props.modelValue;
17080
+ return res;
17081
+ },
17082
+ set() {
17083
+ modelValue.value = "";
17084
+ }
17085
+ });
17081
17086
  vue.watch(() => props.modelValue, (n, o) => {
17082
17087
  if (!props.defaultnow)
17083
17088
  return;
@@ -17097,20 +17102,19 @@ var __async = (__this, __arguments, generator) => {
17097
17102
  const _component_van_field = vue.resolveComponent("van-field");
17098
17103
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [!vue.unref(isGone) ? (vue.openBlock(), vue.createBlock(_component_van_field, {
17099
17104
  key: 0,
17100
- modelValue: props.modelValue,
17101
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => props.modelValue = $event),
17105
+ modelValue: vue.unref(formatTime),
17106
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(formatTime) ? formatTime.value = $event : null),
17102
17107
  name: "datetimePicker",
17103
17108
  label: props.label,
17109
+ disabled: vue.unref(isDisabled),
17110
+ readonly: vue.unref(isReadonly),
17111
+ clearable: "",
17104
17112
  placeholder: props.placeholder,
17105
- readonly: "",
17106
17113
  required: vue.unref(isRequired),
17107
17114
  rules: props.rules,
17108
- "is-link": vue.unref(isReadonly) ? false : true,
17109
- onClick: onToggleShow
17110
- }, {
17111
- input: vue.withCtx(() => [vue.createTextVNode(vue.toDisplayString(formatTime(props.modelValue)), 1)]),
17112
- _: 1
17113
- }, 8, ["modelValue", "label", "placeholder", "required", "rules", "is-link"])) : vue.createCommentVNode("", true), vue.createVNode(_sfc_main$p, {
17115
+ "right-icon": "arrow",
17116
+ onClickRightIcon: onToggleShow
17117
+ }, null, 8, ["modelValue", "label", "disabled", "readonly", "placeholder", "required", "rules"])) : vue.createCommentVNode("", true), vue.createVNode(_sfc_main$p, {
17114
17118
  isShow: data2.isShow,
17115
17119
  "onUpdate:isShow": _cache[1] || (_cache[1] = ($event) => data2.isShow = $event),
17116
17120
  modelValue: vue.unref(modelValue),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "widget.qw",
3
3
  "private": false,
4
- "version": "1.0.47",
4
+ "version": "1.0.49",
5
5
  "description": "marqstree Vue3组件库",
6
6
  "main": "build/widget.qw.es.js",
7
7
  "keywords": [
@@ -1,36 +1,32 @@
1
1
  <template>
2
- <van-field v-if="!isGone"
3
- v-model="props.modelValue" name="datetimePicker" :label="props.label"
4
- :placeholder="props.placeholder" readonly :required="isRequired" :rules="props.rules"
5
- :is-link="isReadonly ? false : true"
6
- @click="onToggleShow">
7
- <template #input>
8
- {{ formatTime(props.modelValue) }}
9
- </template>
2
+ <van-field v-if="!isGone" v-model="formatTime" name="datetimePicker" :label="props.label"
3
+ :disabled="isDisabled"
4
+ :readonly="isReadonly"
5
+ readonly
6
+ clearable
7
+ :placeholder="props.placeholder" :required="isRequired" :rules="props.rules"
8
+ right-icon="arrow"
9
+ @click-right-icon="onToggleShow">
10
10
  </van-field>
11
11
 
12
12
  <!-- 弹出层 -->
13
- <DatetimePop v-model:isShow="data.isShow"
14
- v-model="modelValue"
15
- :before="props.before"
16
- :defaultnow="props.defaultnow"
13
+ <DatetimePop v-model:isShow="data.isShow" v-model="modelValue" :before="props.before" :defaultnow="props.defaultnow"
17
14
  :columnsType="props.columnsType" />
18
15
  </template>
19
16
 
20
-
21
17
  <script setup>
22
- import { ref,reactive, watch, getCurrentInstance, computed } from "vue"
18
+ import { ref, reactive, watch, getCurrentInstance, computed } from "vue"
23
19
  import DatetimePop from './DatetimePop.vue'
24
20
  import util from '../../util'
25
21
  import { useVModel } from "@vueuse/core"
26
22
 
27
23
  const props = defineProps({
28
- modelValue:{
24
+ modelValue: {
29
25
  type: String,
30
26
  default: ''
31
27
  },
32
28
  label: {
33
- type:String,
29
+ type: String,
34
30
  default: ''
35
31
  },
36
32
  readonly: {
@@ -41,7 +37,7 @@ const props = defineProps({
41
37
  type: Boolean,
42
38
  default: false
43
39
  },
44
- before:{
40
+ before: {
45
41
  type: Boolean,
46
42
  default: false
47
43
  },
@@ -53,35 +49,40 @@ const props = defineProps({
53
49
  type: Array,
54
50
  default: ['year', 'month', 'day', 'hour', 'minute', 'second']
55
51
  },
56
- placeholder:{
57
- type:String,
58
- default:''
52
+ placeholder: {
53
+ type: String,
54
+ default: ''
59
55
  },
60
- auth:{
61
- type:String,
62
- default:''
56
+ auth: {
57
+ type: String,
58
+ default: ''
63
59
  },
64
- rules:{
60
+ rules: {
65
61
  type: Array,
66
- default:null
62
+ default: null
67
63
  }
68
64
  })
69
65
  const data = reactive({
70
66
  isShow: false, //是否显示弹出层
71
67
  })
72
- const {isRequired, isReadonly, isGone,isDisabled} = util.props2auth(props)
68
+ const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props)
73
69
  //定义要向父组件传递的事件
74
70
  const emit = defineEmits(["update:modelValue"])
75
71
  const modelValue = useVModel(props, "modelValue", emit)
76
72
 
77
- const formatTime=(time)=>{
78
- let res = time
73
+ const formatTime = computed({
74
+ get() {
75
+ let res = props.modelValue
79
76
 
80
- // let week_day = util.date2week_day(time)
81
- // res = time+'/'+week_day
77
+ // let week_day = util.date2week_day(time)
78
+ // res = time+'/'+week_day
82
79
 
83
- return res
84
- }
80
+ return res
81
+ },
82
+ set() {
83
+ modelValue.value = ''
84
+ }
85
+ })
85
86
 
86
87
  // 默认当前时间
87
88
  watch(
@@ -95,7 +96,7 @@ watch(
95
96
  if (n) {
96
97
  return
97
98
  }
98
-
99
+
99
100
  // 没有值时,默认设置为当前时间
100
101
  modelValue.value = util.date2yyyyMMddhhmmss(new Date())
101
102
  },