@deot/vc-components 1.0.5 → 1.0.6

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/dist/index.cjs CHANGED
@@ -2295,6 +2295,7 @@ const props$Q = {
2295
2295
  type: Boolean,
2296
2296
  default: true
2297
2297
  },
2298
+ // 单位ms
2298
2299
  duration: {
2299
2300
  type: Number,
2300
2301
  default: 3e3
@@ -2326,7 +2327,11 @@ const MToastView = /* @__PURE__ */ vue.defineComponent({
2326
2327
  emit,
2327
2328
  expose
2328
2329
  }) {
2329
- const isVisible = vue.ref(false);
2330
+ const isActive = vue.ref(false);
2331
+ const currentContent = vue.ref();
2332
+ const setContent = v => {
2333
+ currentContent.value = v;
2334
+ };
2330
2335
 
2331
2336
  // 兼容Portal设计
2332
2337
  const handleRemove = () => {
@@ -2335,17 +2340,17 @@ const MToastView = /* @__PURE__ */ vue.defineComponent({
2335
2340
  };
2336
2341
  const handleClose = () => {
2337
2342
  if (props.maskClosable) {
2338
- isVisible.value = false;
2343
+ isActive.value = false;
2339
2344
  }
2340
2345
  };
2346
+ vue.watch(() => props.content, setContent, {
2347
+ immediate: true
2348
+ });
2341
2349
  let timer;
2342
2350
  vue.onMounted(() => {
2343
- isVisible.value = true;
2351
+ isActive.value = true;
2344
2352
  if (props.duration !== 0) {
2345
- timer = setTimeout(() => {
2346
- // 主线程
2347
- isVisible.value = false;
2348
- }, props.duration - 300); // 动画时间
2353
+ timer = setTimeout(() => isActive.value = false, props.duration);
2349
2354
  }
2350
2355
  });
2351
2356
  vue.onUnmounted(() => {
@@ -2374,12 +2379,12 @@ const MToastView = /* @__PURE__ */ vue.defineComponent({
2374
2379
  "class": "vcm-toast__wrapper"
2375
2380
  }, [props.mode === 'loading' && vue.createVNode(MSpin, {
2376
2381
  "class": "vcm-toast__loading"
2377
- }, null), typeof props.content === 'string' ? vue.createVNode("div", {
2382
+ }, null), typeof currentContent.value === 'string' ? vue.createVNode("div", {
2378
2383
  "class": "vcm-toast__content",
2379
- "innerHTML": props.content
2380
- }, null) : typeof props.content === 'function' ? vue.createVNode(MCustomer, {
2381
- "render": props.content
2382
- }, null) : null]), [[vue.vShow, isVisible.value]])]
2384
+ "innerHTML": currentContent.value
2385
+ }, null) : typeof currentContent.value === 'function' ? vue.createVNode(MCustomer, {
2386
+ "render": currentContent.value
2387
+ }, null) : null]), [[vue.vShow, isActive.value]])]
2383
2388
  })]);
2384
2389
  };
2385
2390
  }
@@ -4338,6 +4343,7 @@ const props$C = {
4338
4343
  type: Boolean,
4339
4344
  default: true
4340
4345
  },
4346
+ // 单位ms
4341
4347
  duration: {
4342
4348
  type: Number,
4343
4349
  default: 1500
@@ -4372,6 +4378,10 @@ const MessageView = /* @__PURE__ */ vue.defineComponent({
4372
4378
  }) {
4373
4379
  const instance = vue.getCurrentInstance();
4374
4380
  const isActive = vue.ref(false);
4381
+ const currentContent = vue.ref();
4382
+ const setContent = v => {
4383
+ currentContent.value = v;
4384
+ };
4375
4385
 
4376
4386
  // 兼容Portal设计
4377
4387
  const handleRemove = () => {
@@ -4391,14 +4401,14 @@ const MessageView = /* @__PURE__ */ vue.defineComponent({
4391
4401
  isActive.value = false;
4392
4402
  }
4393
4403
  };
4404
+ vue.watch(() => props.content, setContent, {
4405
+ immediate: true
4406
+ });
4394
4407
  let timer;
4395
4408
  vue.onMounted(() => {
4396
4409
  isActive.value = true;
4397
4410
  if (props.duration !== 0) {
4398
- timer = setTimeout(() => {
4399
- // 主线程
4400
- isActive.value = false;
4401
- }, props.duration * 1000 - 300); // 动画时间
4411
+ timer = setTimeout(() => isActive.value = false, props.duration);
4402
4412
  }
4403
4413
  });
4404
4414
  vue.onUnmounted(() => {
@@ -4407,7 +4417,9 @@ const MessageView = /* @__PURE__ */ vue.defineComponent({
4407
4417
  const exposes = ['destroy', 'remove', 'close', 'hide'].reduce((pre, key) => {
4408
4418
  pre[key] = handleRemove;
4409
4419
  return pre;
4410
- }, {});
4420
+ }, {
4421
+ setContent
4422
+ });
4411
4423
  expose(exposes);
4412
4424
  return () => {
4413
4425
  return vue.createVNode("div", {
@@ -4434,11 +4446,11 @@ const MessageView = /* @__PURE__ */ vue.defineComponent({
4434
4446
  }, null) : vue.createVNode(Icon, {
4435
4447
  "type": props.mode,
4436
4448
  "class": [`is-${props.mode}`, 'vc-message__icon']
4437
- }, null), typeof props.content === 'string' ? vue.createVNode("div", {
4449
+ }, null), typeof currentContent.value === 'string' ? vue.createVNode("div", {
4438
4450
  "class": "vc-message__content",
4439
- "innerHTML": props.content
4440
- }, null) : typeof props.content === 'function' ? vue.createVNode(Customer, {
4441
- "render": props.content
4451
+ "innerHTML": currentContent.value
4452
+ }, null) : typeof currentContent.value === 'function' ? vue.createVNode(Customer, {
4453
+ "render": currentContent.value
4442
4454
  }, null) : null, props.closable && vue.createVNode(Icon, {
4443
4455
  "type": "close",
4444
4456
  "class": "vc-message__close",
@@ -5158,9 +5170,10 @@ const modal = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
5158
5170
  const props$z = {
5159
5171
  title: [String, Function],
5160
5172
  content: [String, Function],
5173
+ // 单位ms
5161
5174
  duration: {
5162
5175
  type: Number,
5163
- default: 450
5176
+ default: 4500
5164
5177
  },
5165
5178
  closable: {
5166
5179
  type: Boolean,
@@ -5194,14 +5207,25 @@ const NoticeView = /* @__PURE__ */ vue.defineComponent({
5194
5207
  }) {
5195
5208
  const instance = vue.getCurrentInstance();
5196
5209
  const isActive = vue.ref(false);
5210
+ const currentTitle = vue.ref();
5211
+ const currentContent = vue.ref();
5212
+ const setTitle = v => {
5213
+ currentTitle.value = v;
5214
+ };
5215
+ const setContent = v => {
5216
+ currentContent.value = v;
5217
+ };
5218
+ vue.watch(() => props.title, setTitle, {
5219
+ immediate: true
5220
+ });
5221
+ vue.watch(() => props.content, setContent, {
5222
+ immediate: true
5223
+ });
5197
5224
  let timer;
5198
5225
  vue.onMounted(() => {
5199
5226
  isActive.value = true;
5200
5227
  if (props.duration !== 0) {
5201
- timer = setTimeout(() => {
5202
- // 主线程
5203
- isActive.value = false;
5204
- }, props.duration * 1000 - 300); // 动画时间
5228
+ timer = setTimeout(() => isActive.value = false, props.duration);
5205
5229
  }
5206
5230
  });
5207
5231
  vue.onUnmounted(() => {
@@ -5245,21 +5269,21 @@ const NoticeView = /* @__PURE__ */ vue.defineComponent({
5245
5269
  }, [props.mode && vue.createVNode(Icon, {
5246
5270
  "type": `o-${props.mode}`,
5247
5271
  "class": [`is-${props.mode}`, 'vc-notice__icon']
5248
- }, null), vue.createVNode("div", null, [props.title && vue.createVNode("div", {
5272
+ }, null), vue.createVNode("div", null, [currentTitle.value && vue.createVNode("div", {
5249
5273
  "style": [{
5250
- marginBottom: props.content ? '8px' : ''
5274
+ marginBottom: currentContent.value ? '8px' : ''
5251
5275
  }],
5252
5276
  "class": "vc-notice__title"
5253
- }, [typeof props.title === 'string' ? vue.createVNode("div", {
5254
- "innerHTML": props.title
5255
- }, null) : typeof props.title === 'function' ? vue.createVNode(Customer, {
5256
- "render": props.title
5257
- }, null) : null]), props.content && vue.createVNode("div", {
5277
+ }, [typeof currentTitle.value === 'string' ? vue.createVNode("div", {
5278
+ "innerHTML": currentTitle.value
5279
+ }, null) : typeof currentTitle.value === 'function' ? vue.createVNode(Customer, {
5280
+ "render": currentTitle.value
5281
+ }, null) : null]), currentContent.value && vue.createVNode("div", {
5258
5282
  "class": "vc-notice__content"
5259
- }, [typeof props.content === 'string' ? vue.createVNode("div", {
5260
- "innerHTML": props.content
5261
- }, null) : typeof props.content === 'function' ? vue.createVNode(Customer, {
5262
- "render": props.content
5283
+ }, [typeof currentContent.value === 'string' ? vue.createVNode("div", {
5284
+ "innerHTML": currentContent.value
5285
+ }, null) : typeof currentContent.value === 'function' ? vue.createVNode(Customer, {
5286
+ "render": currentContent.value
5263
5287
  }, null) : null])]), props.closable && vue.createVNode(Icon, {
5264
5288
  "type": "close",
5265
5289
  "style": "font-size: 12px",
@@ -5975,6 +5975,7 @@ var VcComponents = (function (exports, vue) {
5975
5975
  type: Boolean,
5976
5976
  default: true
5977
5977
  },
5978
+ // 单位ms
5978
5979
  duration: {
5979
5980
  type: Number,
5980
5981
  default: 3e3
@@ -6006,7 +6007,11 @@ var VcComponents = (function (exports, vue) {
6006
6007
  emit,
6007
6008
  expose
6008
6009
  }) {
6009
- const isVisible = vue.ref(false);
6010
+ const isActive = vue.ref(false);
6011
+ const currentContent = vue.ref();
6012
+ const setContent = v => {
6013
+ currentContent.value = v;
6014
+ };
6010
6015
 
6011
6016
  // 兼容Portal设计
6012
6017
  const handleRemove = () => {
@@ -6015,17 +6020,17 @@ var VcComponents = (function (exports, vue) {
6015
6020
  };
6016
6021
  const handleClose = () => {
6017
6022
  if (props.maskClosable) {
6018
- isVisible.value = false;
6023
+ isActive.value = false;
6019
6024
  }
6020
6025
  };
6026
+ vue.watch(() => props.content, setContent, {
6027
+ immediate: true
6028
+ });
6021
6029
  let timer;
6022
6030
  vue.onMounted(() => {
6023
- isVisible.value = true;
6031
+ isActive.value = true;
6024
6032
  if (props.duration !== 0) {
6025
- timer = setTimeout(() => {
6026
- // 主线程
6027
- isVisible.value = false;
6028
- }, props.duration - 300); // 动画时间
6033
+ timer = setTimeout(() => isActive.value = false, props.duration);
6029
6034
  }
6030
6035
  });
6031
6036
  vue.onUnmounted(() => {
@@ -6054,12 +6059,12 @@ var VcComponents = (function (exports, vue) {
6054
6059
  "class": "vcm-toast__wrapper"
6055
6060
  }, [props.mode === 'loading' && vue.createVNode(MSpin, {
6056
6061
  "class": "vcm-toast__loading"
6057
- }, null), typeof props.content === 'string' ? vue.createVNode("div", {
6062
+ }, null), typeof currentContent.value === 'string' ? vue.createVNode("div", {
6058
6063
  "class": "vcm-toast__content",
6059
- "innerHTML": props.content
6060
- }, null) : typeof props.content === 'function' ? vue.createVNode(MCustomer, {
6061
- "render": props.content
6062
- }, null) : null]), [[vue.vShow, isVisible.value]])]
6064
+ "innerHTML": currentContent.value
6065
+ }, null) : typeof currentContent.value === 'function' ? vue.createVNode(MCustomer, {
6066
+ "render": currentContent.value
6067
+ }, null) : null]), [[vue.vShow, isActive.value]])]
6063
6068
  })]);
6064
6069
  };
6065
6070
  }
@@ -8649,6 +8654,7 @@ var VcComponents = (function (exports, vue) {
8649
8654
  type: Boolean,
8650
8655
  default: true
8651
8656
  },
8657
+ // 单位ms
8652
8658
  duration: {
8653
8659
  type: Number,
8654
8660
  default: 1500
@@ -8683,6 +8689,10 @@ var VcComponents = (function (exports, vue) {
8683
8689
  }) {
8684
8690
  const instance = vue.getCurrentInstance();
8685
8691
  const isActive = vue.ref(false);
8692
+ const currentContent = vue.ref();
8693
+ const setContent = v => {
8694
+ currentContent.value = v;
8695
+ };
8686
8696
 
8687
8697
  // 兼容Portal设计
8688
8698
  const handleRemove = () => {
@@ -8702,14 +8712,14 @@ var VcComponents = (function (exports, vue) {
8702
8712
  isActive.value = false;
8703
8713
  }
8704
8714
  };
8715
+ vue.watch(() => props.content, setContent, {
8716
+ immediate: true
8717
+ });
8705
8718
  let timer;
8706
8719
  vue.onMounted(() => {
8707
8720
  isActive.value = true;
8708
8721
  if (props.duration !== 0) {
8709
- timer = setTimeout(() => {
8710
- // 主线程
8711
- isActive.value = false;
8712
- }, props.duration * 1000 - 300); // 动画时间
8722
+ timer = setTimeout(() => isActive.value = false, props.duration);
8713
8723
  }
8714
8724
  });
8715
8725
  vue.onUnmounted(() => {
@@ -8718,7 +8728,9 @@ var VcComponents = (function (exports, vue) {
8718
8728
  const exposes = ['destroy', 'remove', 'close', 'hide'].reduce((pre, key) => {
8719
8729
  pre[key] = handleRemove;
8720
8730
  return pre;
8721
- }, {});
8731
+ }, {
8732
+ setContent
8733
+ });
8722
8734
  expose(exposes);
8723
8735
  return () => {
8724
8736
  return vue.createVNode("div", {
@@ -8745,11 +8757,11 @@ var VcComponents = (function (exports, vue) {
8745
8757
  }, null) : vue.createVNode(Icon, {
8746
8758
  "type": props.mode,
8747
8759
  "class": [`is-${props.mode}`, 'vc-message__icon']
8748
- }, null), typeof props.content === 'string' ? vue.createVNode("div", {
8760
+ }, null), typeof currentContent.value === 'string' ? vue.createVNode("div", {
8749
8761
  "class": "vc-message__content",
8750
- "innerHTML": props.content
8751
- }, null) : typeof props.content === 'function' ? vue.createVNode(Customer, {
8752
- "render": props.content
8762
+ "innerHTML": currentContent.value
8763
+ }, null) : typeof currentContent.value === 'function' ? vue.createVNode(Customer, {
8764
+ "render": currentContent.value
8753
8765
  }, null) : null, props.closable && vue.createVNode(Icon, {
8754
8766
  "type": "close",
8755
8767
  "class": "vc-message__close",
@@ -9469,9 +9481,10 @@ var VcComponents = (function (exports, vue) {
9469
9481
  const props$z = {
9470
9482
  title: [String, Function],
9471
9483
  content: [String, Function],
9484
+ // 单位ms
9472
9485
  duration: {
9473
9486
  type: Number,
9474
- default: 450
9487
+ default: 4500
9475
9488
  },
9476
9489
  closable: {
9477
9490
  type: Boolean,
@@ -9505,14 +9518,25 @@ var VcComponents = (function (exports, vue) {
9505
9518
  }) {
9506
9519
  const instance = vue.getCurrentInstance();
9507
9520
  const isActive = vue.ref(false);
9521
+ const currentTitle = vue.ref();
9522
+ const currentContent = vue.ref();
9523
+ const setTitle = v => {
9524
+ currentTitle.value = v;
9525
+ };
9526
+ const setContent = v => {
9527
+ currentContent.value = v;
9528
+ };
9529
+ vue.watch(() => props.title, setTitle, {
9530
+ immediate: true
9531
+ });
9532
+ vue.watch(() => props.content, setContent, {
9533
+ immediate: true
9534
+ });
9508
9535
  let timer;
9509
9536
  vue.onMounted(() => {
9510
9537
  isActive.value = true;
9511
9538
  if (props.duration !== 0) {
9512
- timer = setTimeout(() => {
9513
- // 主线程
9514
- isActive.value = false;
9515
- }, props.duration * 1000 - 300); // 动画时间
9539
+ timer = setTimeout(() => isActive.value = false, props.duration);
9516
9540
  }
9517
9541
  });
9518
9542
  vue.onUnmounted(() => {
@@ -9556,21 +9580,21 @@ var VcComponents = (function (exports, vue) {
9556
9580
  }, [props.mode && vue.createVNode(Icon, {
9557
9581
  "type": `o-${props.mode}`,
9558
9582
  "class": [`is-${props.mode}`, 'vc-notice__icon']
9559
- }, null), vue.createVNode("div", null, [props.title && vue.createVNode("div", {
9583
+ }, null), vue.createVNode("div", null, [currentTitle.value && vue.createVNode("div", {
9560
9584
  "style": [{
9561
- marginBottom: props.content ? '8px' : ''
9585
+ marginBottom: currentContent.value ? '8px' : ''
9562
9586
  }],
9563
9587
  "class": "vc-notice__title"
9564
- }, [typeof props.title === 'string' ? vue.createVNode("div", {
9565
- "innerHTML": props.title
9566
- }, null) : typeof props.title === 'function' ? vue.createVNode(Customer, {
9567
- "render": props.title
9568
- }, null) : null]), props.content && vue.createVNode("div", {
9588
+ }, [typeof currentTitle.value === 'string' ? vue.createVNode("div", {
9589
+ "innerHTML": currentTitle.value
9590
+ }, null) : typeof currentTitle.value === 'function' ? vue.createVNode(Customer, {
9591
+ "render": currentTitle.value
9592
+ }, null) : null]), currentContent.value && vue.createVNode("div", {
9569
9593
  "class": "vc-notice__content"
9570
- }, [typeof props.content === 'string' ? vue.createVNode("div", {
9571
- "innerHTML": props.content
9572
- }, null) : typeof props.content === 'function' ? vue.createVNode(Customer, {
9573
- "render": props.content
9594
+ }, [typeof currentContent.value === 'string' ? vue.createVNode("div", {
9595
+ "innerHTML": currentContent.value
9596
+ }, null) : typeof currentContent.value === 'function' ? vue.createVNode(Customer, {
9597
+ "render": currentContent.value
9574
9598
  }, null) : null])]), props.closable && vue.createVNode(Icon, {
9575
9599
  "type": "close",
9576
9600
  "style": "font-size: 12px",
package/dist/index.js CHANGED
@@ -2272,6 +2272,7 @@ const props$Q = {
2272
2272
  type: Boolean,
2273
2273
  default: true
2274
2274
  },
2275
+ // 单位ms
2275
2276
  duration: {
2276
2277
  type: Number,
2277
2278
  default: 3e3
@@ -2303,7 +2304,11 @@ const MToastView = /* @__PURE__ */ defineComponent({
2303
2304
  emit,
2304
2305
  expose
2305
2306
  }) {
2306
- const isVisible = ref(false);
2307
+ const isActive = ref(false);
2308
+ const currentContent = ref();
2309
+ const setContent = v => {
2310
+ currentContent.value = v;
2311
+ };
2307
2312
 
2308
2313
  // 兼容Portal设计
2309
2314
  const handleRemove = () => {
@@ -2312,17 +2317,17 @@ const MToastView = /* @__PURE__ */ defineComponent({
2312
2317
  };
2313
2318
  const handleClose = () => {
2314
2319
  if (props.maskClosable) {
2315
- isVisible.value = false;
2320
+ isActive.value = false;
2316
2321
  }
2317
2322
  };
2323
+ watch(() => props.content, setContent, {
2324
+ immediate: true
2325
+ });
2318
2326
  let timer;
2319
2327
  onMounted(() => {
2320
- isVisible.value = true;
2328
+ isActive.value = true;
2321
2329
  if (props.duration !== 0) {
2322
- timer = setTimeout(() => {
2323
- // 主线程
2324
- isVisible.value = false;
2325
- }, props.duration - 300); // 动画时间
2330
+ timer = setTimeout(() => isActive.value = false, props.duration);
2326
2331
  }
2327
2332
  });
2328
2333
  onUnmounted(() => {
@@ -2351,12 +2356,12 @@ const MToastView = /* @__PURE__ */ defineComponent({
2351
2356
  "class": "vcm-toast__wrapper"
2352
2357
  }, [props.mode === 'loading' && createVNode(MSpin, {
2353
2358
  "class": "vcm-toast__loading"
2354
- }, null), typeof props.content === 'string' ? createVNode("div", {
2359
+ }, null), typeof currentContent.value === 'string' ? createVNode("div", {
2355
2360
  "class": "vcm-toast__content",
2356
- "innerHTML": props.content
2357
- }, null) : typeof props.content === 'function' ? createVNode(MCustomer, {
2358
- "render": props.content
2359
- }, null) : null]), [[vShow, isVisible.value]])]
2361
+ "innerHTML": currentContent.value
2362
+ }, null) : typeof currentContent.value === 'function' ? createVNode(MCustomer, {
2363
+ "render": currentContent.value
2364
+ }, null) : null]), [[vShow, isActive.value]])]
2360
2365
  })]);
2361
2366
  };
2362
2367
  }
@@ -4315,6 +4320,7 @@ const props$C = {
4315
4320
  type: Boolean,
4316
4321
  default: true
4317
4322
  },
4323
+ // 单位ms
4318
4324
  duration: {
4319
4325
  type: Number,
4320
4326
  default: 1500
@@ -4349,6 +4355,10 @@ const MessageView = /* @__PURE__ */ defineComponent({
4349
4355
  }) {
4350
4356
  const instance = getCurrentInstance();
4351
4357
  const isActive = ref(false);
4358
+ const currentContent = ref();
4359
+ const setContent = v => {
4360
+ currentContent.value = v;
4361
+ };
4352
4362
 
4353
4363
  // 兼容Portal设计
4354
4364
  const handleRemove = () => {
@@ -4368,14 +4378,14 @@ const MessageView = /* @__PURE__ */ defineComponent({
4368
4378
  isActive.value = false;
4369
4379
  }
4370
4380
  };
4381
+ watch(() => props.content, setContent, {
4382
+ immediate: true
4383
+ });
4371
4384
  let timer;
4372
4385
  onMounted(() => {
4373
4386
  isActive.value = true;
4374
4387
  if (props.duration !== 0) {
4375
- timer = setTimeout(() => {
4376
- // 主线程
4377
- isActive.value = false;
4378
- }, props.duration * 1000 - 300); // 动画时间
4388
+ timer = setTimeout(() => isActive.value = false, props.duration);
4379
4389
  }
4380
4390
  });
4381
4391
  onUnmounted(() => {
@@ -4384,7 +4394,9 @@ const MessageView = /* @__PURE__ */ defineComponent({
4384
4394
  const exposes = ['destroy', 'remove', 'close', 'hide'].reduce((pre, key) => {
4385
4395
  pre[key] = handleRemove;
4386
4396
  return pre;
4387
- }, {});
4397
+ }, {
4398
+ setContent
4399
+ });
4388
4400
  expose(exposes);
4389
4401
  return () => {
4390
4402
  return createVNode("div", {
@@ -4411,11 +4423,11 @@ const MessageView = /* @__PURE__ */ defineComponent({
4411
4423
  }, null) : createVNode(Icon, {
4412
4424
  "type": props.mode,
4413
4425
  "class": [`is-${props.mode}`, 'vc-message__icon']
4414
- }, null), typeof props.content === 'string' ? createVNode("div", {
4426
+ }, null), typeof currentContent.value === 'string' ? createVNode("div", {
4415
4427
  "class": "vc-message__content",
4416
- "innerHTML": props.content
4417
- }, null) : typeof props.content === 'function' ? createVNode(Customer, {
4418
- "render": props.content
4428
+ "innerHTML": currentContent.value
4429
+ }, null) : typeof currentContent.value === 'function' ? createVNode(Customer, {
4430
+ "render": currentContent.value
4419
4431
  }, null) : null, props.closable && createVNode(Icon, {
4420
4432
  "type": "close",
4421
4433
  "class": "vc-message__close",
@@ -5135,9 +5147,10 @@ const modal = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
5135
5147
  const props$z = {
5136
5148
  title: [String, Function],
5137
5149
  content: [String, Function],
5150
+ // 单位ms
5138
5151
  duration: {
5139
5152
  type: Number,
5140
- default: 450
5153
+ default: 4500
5141
5154
  },
5142
5155
  closable: {
5143
5156
  type: Boolean,
@@ -5171,14 +5184,25 @@ const NoticeView = /* @__PURE__ */ defineComponent({
5171
5184
  }) {
5172
5185
  const instance = getCurrentInstance();
5173
5186
  const isActive = ref(false);
5187
+ const currentTitle = ref();
5188
+ const currentContent = ref();
5189
+ const setTitle = v => {
5190
+ currentTitle.value = v;
5191
+ };
5192
+ const setContent = v => {
5193
+ currentContent.value = v;
5194
+ };
5195
+ watch(() => props.title, setTitle, {
5196
+ immediate: true
5197
+ });
5198
+ watch(() => props.content, setContent, {
5199
+ immediate: true
5200
+ });
5174
5201
  let timer;
5175
5202
  onMounted(() => {
5176
5203
  isActive.value = true;
5177
5204
  if (props.duration !== 0) {
5178
- timer = setTimeout(() => {
5179
- // 主线程
5180
- isActive.value = false;
5181
- }, props.duration * 1000 - 300); // 动画时间
5205
+ timer = setTimeout(() => isActive.value = false, props.duration);
5182
5206
  }
5183
5207
  });
5184
5208
  onUnmounted(() => {
@@ -5222,21 +5246,21 @@ const NoticeView = /* @__PURE__ */ defineComponent({
5222
5246
  }, [props.mode && createVNode(Icon, {
5223
5247
  "type": `o-${props.mode}`,
5224
5248
  "class": [`is-${props.mode}`, 'vc-notice__icon']
5225
- }, null), createVNode("div", null, [props.title && createVNode("div", {
5249
+ }, null), createVNode("div", null, [currentTitle.value && createVNode("div", {
5226
5250
  "style": [{
5227
- marginBottom: props.content ? '8px' : ''
5251
+ marginBottom: currentContent.value ? '8px' : ''
5228
5252
  }],
5229
5253
  "class": "vc-notice__title"
5230
- }, [typeof props.title === 'string' ? createVNode("div", {
5231
- "innerHTML": props.title
5232
- }, null) : typeof props.title === 'function' ? createVNode(Customer, {
5233
- "render": props.title
5234
- }, null) : null]), props.content && createVNode("div", {
5254
+ }, [typeof currentTitle.value === 'string' ? createVNode("div", {
5255
+ "innerHTML": currentTitle.value
5256
+ }, null) : typeof currentTitle.value === 'function' ? createVNode(Customer, {
5257
+ "render": currentTitle.value
5258
+ }, null) : null]), currentContent.value && createVNode("div", {
5235
5259
  "class": "vc-notice__content"
5236
- }, [typeof props.content === 'string' ? createVNode("div", {
5237
- "innerHTML": props.content
5238
- }, null) : typeof props.content === 'function' ? createVNode(Customer, {
5239
- "render": props.content
5260
+ }, [typeof currentContent.value === 'string' ? createVNode("div", {
5261
+ "innerHTML": currentContent.value
5262
+ }, null) : typeof currentContent.value === 'function' ? createVNode(Customer, {
5263
+ "render": currentContent.value
5240
5264
  }, null) : null])]), props.closable && createVNode(Icon, {
5241
5265
  "type": "close",
5242
5266
  "style": "font-size: 12px",
@@ -5978,6 +5978,7 @@
5978
5978
  type: Boolean,
5979
5979
  default: true
5980
5980
  },
5981
+ // 单位ms
5981
5982
  duration: {
5982
5983
  type: Number,
5983
5984
  default: 3e3
@@ -6009,7 +6010,11 @@
6009
6010
  emit,
6010
6011
  expose
6011
6012
  }) {
6012
- const isVisible = vue.ref(false);
6013
+ const isActive = vue.ref(false);
6014
+ const currentContent = vue.ref();
6015
+ const setContent = v => {
6016
+ currentContent.value = v;
6017
+ };
6013
6018
 
6014
6019
  // 兼容Portal设计
6015
6020
  const handleRemove = () => {
@@ -6018,17 +6023,17 @@
6018
6023
  };
6019
6024
  const handleClose = () => {
6020
6025
  if (props.maskClosable) {
6021
- isVisible.value = false;
6026
+ isActive.value = false;
6022
6027
  }
6023
6028
  };
6029
+ vue.watch(() => props.content, setContent, {
6030
+ immediate: true
6031
+ });
6024
6032
  let timer;
6025
6033
  vue.onMounted(() => {
6026
- isVisible.value = true;
6034
+ isActive.value = true;
6027
6035
  if (props.duration !== 0) {
6028
- timer = setTimeout(() => {
6029
- // 主线程
6030
- isVisible.value = false;
6031
- }, props.duration - 300); // 动画时间
6036
+ timer = setTimeout(() => isActive.value = false, props.duration);
6032
6037
  }
6033
6038
  });
6034
6039
  vue.onUnmounted(() => {
@@ -6057,12 +6062,12 @@
6057
6062
  "class": "vcm-toast__wrapper"
6058
6063
  }, [props.mode === 'loading' && vue.createVNode(MSpin, {
6059
6064
  "class": "vcm-toast__loading"
6060
- }, null), typeof props.content === 'string' ? vue.createVNode("div", {
6065
+ }, null), typeof currentContent.value === 'string' ? vue.createVNode("div", {
6061
6066
  "class": "vcm-toast__content",
6062
- "innerHTML": props.content
6063
- }, null) : typeof props.content === 'function' ? vue.createVNode(MCustomer, {
6064
- "render": props.content
6065
- }, null) : null]), [[vue.vShow, isVisible.value]])]
6067
+ "innerHTML": currentContent.value
6068
+ }, null) : typeof currentContent.value === 'function' ? vue.createVNode(MCustomer, {
6069
+ "render": currentContent.value
6070
+ }, null) : null]), [[vue.vShow, isActive.value]])]
6066
6071
  })]);
6067
6072
  };
6068
6073
  }
@@ -8652,6 +8657,7 @@
8652
8657
  type: Boolean,
8653
8658
  default: true
8654
8659
  },
8660
+ // 单位ms
8655
8661
  duration: {
8656
8662
  type: Number,
8657
8663
  default: 1500
@@ -8686,6 +8692,10 @@
8686
8692
  }) {
8687
8693
  const instance = vue.getCurrentInstance();
8688
8694
  const isActive = vue.ref(false);
8695
+ const currentContent = vue.ref();
8696
+ const setContent = v => {
8697
+ currentContent.value = v;
8698
+ };
8689
8699
 
8690
8700
  // 兼容Portal设计
8691
8701
  const handleRemove = () => {
@@ -8705,14 +8715,14 @@
8705
8715
  isActive.value = false;
8706
8716
  }
8707
8717
  };
8718
+ vue.watch(() => props.content, setContent, {
8719
+ immediate: true
8720
+ });
8708
8721
  let timer;
8709
8722
  vue.onMounted(() => {
8710
8723
  isActive.value = true;
8711
8724
  if (props.duration !== 0) {
8712
- timer = setTimeout(() => {
8713
- // 主线程
8714
- isActive.value = false;
8715
- }, props.duration * 1000 - 300); // 动画时间
8725
+ timer = setTimeout(() => isActive.value = false, props.duration);
8716
8726
  }
8717
8727
  });
8718
8728
  vue.onUnmounted(() => {
@@ -8721,7 +8731,9 @@
8721
8731
  const exposes = ['destroy', 'remove', 'close', 'hide'].reduce((pre, key) => {
8722
8732
  pre[key] = handleRemove;
8723
8733
  return pre;
8724
- }, {});
8734
+ }, {
8735
+ setContent
8736
+ });
8725
8737
  expose(exposes);
8726
8738
  return () => {
8727
8739
  return vue.createVNode("div", {
@@ -8748,11 +8760,11 @@
8748
8760
  }, null) : vue.createVNode(Icon, {
8749
8761
  "type": props.mode,
8750
8762
  "class": [`is-${props.mode}`, 'vc-message__icon']
8751
- }, null), typeof props.content === 'string' ? vue.createVNode("div", {
8763
+ }, null), typeof currentContent.value === 'string' ? vue.createVNode("div", {
8752
8764
  "class": "vc-message__content",
8753
- "innerHTML": props.content
8754
- }, null) : typeof props.content === 'function' ? vue.createVNode(Customer, {
8755
- "render": props.content
8765
+ "innerHTML": currentContent.value
8766
+ }, null) : typeof currentContent.value === 'function' ? vue.createVNode(Customer, {
8767
+ "render": currentContent.value
8756
8768
  }, null) : null, props.closable && vue.createVNode(Icon, {
8757
8769
  "type": "close",
8758
8770
  "class": "vc-message__close",
@@ -9472,9 +9484,10 @@
9472
9484
  const props$z = {
9473
9485
  title: [String, Function],
9474
9486
  content: [String, Function],
9487
+ // 单位ms
9475
9488
  duration: {
9476
9489
  type: Number,
9477
- default: 450
9490
+ default: 4500
9478
9491
  },
9479
9492
  closable: {
9480
9493
  type: Boolean,
@@ -9508,14 +9521,25 @@
9508
9521
  }) {
9509
9522
  const instance = vue.getCurrentInstance();
9510
9523
  const isActive = vue.ref(false);
9524
+ const currentTitle = vue.ref();
9525
+ const currentContent = vue.ref();
9526
+ const setTitle = v => {
9527
+ currentTitle.value = v;
9528
+ };
9529
+ const setContent = v => {
9530
+ currentContent.value = v;
9531
+ };
9532
+ vue.watch(() => props.title, setTitle, {
9533
+ immediate: true
9534
+ });
9535
+ vue.watch(() => props.content, setContent, {
9536
+ immediate: true
9537
+ });
9511
9538
  let timer;
9512
9539
  vue.onMounted(() => {
9513
9540
  isActive.value = true;
9514
9541
  if (props.duration !== 0) {
9515
- timer = setTimeout(() => {
9516
- // 主线程
9517
- isActive.value = false;
9518
- }, props.duration * 1000 - 300); // 动画时间
9542
+ timer = setTimeout(() => isActive.value = false, props.duration);
9519
9543
  }
9520
9544
  });
9521
9545
  vue.onUnmounted(() => {
@@ -9559,21 +9583,21 @@
9559
9583
  }, [props.mode && vue.createVNode(Icon, {
9560
9584
  "type": `o-${props.mode}`,
9561
9585
  "class": [`is-${props.mode}`, 'vc-notice__icon']
9562
- }, null), vue.createVNode("div", null, [props.title && vue.createVNode("div", {
9586
+ }, null), vue.createVNode("div", null, [currentTitle.value && vue.createVNode("div", {
9563
9587
  "style": [{
9564
- marginBottom: props.content ? '8px' : ''
9588
+ marginBottom: currentContent.value ? '8px' : ''
9565
9589
  }],
9566
9590
  "class": "vc-notice__title"
9567
- }, [typeof props.title === 'string' ? vue.createVNode("div", {
9568
- "innerHTML": props.title
9569
- }, null) : typeof props.title === 'function' ? vue.createVNode(Customer, {
9570
- "render": props.title
9571
- }, null) : null]), props.content && vue.createVNode("div", {
9591
+ }, [typeof currentTitle.value === 'string' ? vue.createVNode("div", {
9592
+ "innerHTML": currentTitle.value
9593
+ }, null) : typeof currentTitle.value === 'function' ? vue.createVNode(Customer, {
9594
+ "render": currentTitle.value
9595
+ }, null) : null]), currentContent.value && vue.createVNode("div", {
9572
9596
  "class": "vc-notice__content"
9573
- }, [typeof props.content === 'string' ? vue.createVNode("div", {
9574
- "innerHTML": props.content
9575
- }, null) : typeof props.content === 'function' ? vue.createVNode(Customer, {
9576
- "render": props.content
9597
+ }, [typeof currentContent.value === 'string' ? vue.createVNode("div", {
9598
+ "innerHTML": currentContent.value
9599
+ }, null) : typeof currentContent.value === 'function' ? vue.createVNode(Customer, {
9600
+ "render": currentContent.value
9577
9601
  }, null) : null])]), props.closable && vue.createVNode(Icon, {
9578
9602
  "type": "close",
9579
9603
  "style": "font-size: 12px",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deot/vc-components",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",