Browse Source

docs(inputnumber): toast usage update

eiinu 3 years ago
parent
commit
03e177b631

+ 4 - 4
src/packages/__VUE/inputnumber/demo.vue

@@ -50,6 +50,7 @@
 import { reactive, getCurrentInstance } from 'vue';
 import { createComponent } from '@/packages/utils/create';
 import { Left, Right } from '@nutui/icons-vue';
+import { showToast } from '@/packages/nutui.vue';
 const { createDemo, translate } = createComponent('input-number');
 import { useTranslate } from '@/sites/assets/util/useTranslate';
 const initTranslate = () =>
@@ -86,7 +87,6 @@ export default createDemo({
   props: {},
   setup() {
     initTranslate();
-    let { proxy } = getCurrentInstance();
 
     const state = reactive({
       val1: 1,
@@ -102,15 +102,15 @@ export default createDemo({
     });
 
     const onChange = (value: number) => {
-      proxy.$toast.loading(translate('content1'));
+      showToast.loading(translate('content1'));
       setTimeout(() => {
         state.val8 = value;
-        proxy.$toast.hide();
+        showToast.hide();
       }, 2000);
     };
 
     const overlimit = () => {
-      proxy.$toast.warn(translate('content2'));
+      showToast.warn(translate('content2'));
     };
 
     return {

+ 4 - 2
src/packages/__VUE/inputnumber/doc.en-US.md

@@ -164,6 +164,8 @@ Asynchronous modification through `change` event and `model-value`
 </template>
 <script lang="ts">
   import { reactive, getCurrentInstance, toRefs } from 'vue';
+  import { showToast } from '@nutui/nutui';
+  import '@nutui/nutui/dist/packages/toast/style';
   export default {
     setup() {
       let { proxy } = getCurrentInstance();
@@ -171,10 +173,10 @@ Asynchronous modification through `change` event and `model-value`
         value: 1
       });
       const onChange = (value: number) => {
-        proxy.$toast.loading('Asynchronous presentation changes in 2 seconds');
+        showToast.loading('Asynchronous presentation changes in 2 seconds');
         setTimeout(() => {
           state.value = value;
-          proxy.$toast.hide();
+          showToast.hide();
         }, 2000);
       };
       return { ...toRefs(state), onChange };

+ 4 - 2
src/packages/__VUE/inputnumber/doc.md

@@ -164,6 +164,8 @@ app.use(InputNumber);
 </template>
 <script lang="ts">
   import { reactive, getCurrentInstance, toRefs } from 'vue';
+  import { showToast } from '@nutui/nutui';
+  import '@nutui/nutui/dist/packages/toast/style';
   export default {
     setup() {
       let { proxy } = getCurrentInstance();
@@ -171,10 +173,10 @@ app.use(InputNumber);
         value: 1
       });
       const onChange = (value: number) => {
-        proxy.$toast.loading('异步演示 2 秒后更改');
+        showToast.loading('异步演示 2 秒后更改');
         setTimeout(() => {
           state.value = value;
-          proxy.$toast.hide();
+          showToast.hide();
         }, 2000);
       };
       return { ...toRefs(state), onChange };

+ 2 - 4
src/packages/__VUE/inputnumber/doc.taro.md

@@ -166,15 +166,13 @@ app.use(InputNumber);
   import { reactive, getCurrentInstance, toRefs } from 'vue';
   export default {
     setup() {
-      let { proxy } = getCurrentInstance();
       const state = reactive({
         value: 1
       });
       const onChange = (value: number) => {
-        proxy.$toast.loading('异步演示 2 秒后更改');
+        console.log('异步演示 2 秒后更改');
         setTimeout(() => {
-          state.value = value;
-          proxy.$toast.hide();
+          state.val8 = value;
         }, 2000);
       };
       return { ...toRefs(state), onChange };