|
|
@@ -7,11 +7,11 @@ Short password input box, which can be used to enter passwords, SMS verification
|
|
|
|
|
|
``` javascript
|
|
|
import { createApp } from 'vue';
|
|
|
-import { ShortPassword } from '@nutui/nutui';
|
|
|
+import { ShortPassword, NumberKeyboard } from '@nutui/nutui';
|
|
|
|
|
|
const app = createApp();
|
|
|
app.use(ShortPassword);
|
|
|
-
|
|
|
+app.use(NumberKeyboard);
|
|
|
```
|
|
|
|
|
|
|
|
|
@@ -19,22 +19,21 @@ app.use(ShortPassword);
|
|
|
:::demo
|
|
|
```html
|
|
|
<template>
|
|
|
-<nut-cell title="Basic Usage" is-link @click="state.visible1 = true;"></nut-cell>
|
|
|
- <nut-short-password
|
|
|
- v-model="state.value1"
|
|
|
- v-model:visible="state.visible1"
|
|
|
- @focus="state.showKeyboard1 = true">
|
|
|
- </nut-short-password>
|
|
|
- <nut-number-keyboard
|
|
|
- v-model="state.value1"
|
|
|
- v-model:visible="state.showKeyboard1"
|
|
|
- @blur="state.showKeyboard1 = false"
|
|
|
- >
|
|
|
- </nut-number-keyboard>
|
|
|
+ <nut-cell title="Basic Usage" is-link @click="state.visible1 = true;"></nut-cell>
|
|
|
+ <nut-short-password
|
|
|
+ v-model="state.value1"
|
|
|
+ v-model:visible="state.visible1"
|
|
|
+ @focus="state.showKeyboard1 = true">
|
|
|
+ </nut-short-password>
|
|
|
+ <nut-number-keyboard
|
|
|
+ v-model="state.value1"
|
|
|
+ v-model:visible="state.showKeyboard1"
|
|
|
+ @blur="state.showKeyboard1 = false"
|
|
|
+ >
|
|
|
+ </nut-number-keyboard>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { reactive } from 'vue';
|
|
|
-import { Toast } from '@nutui/nutui';
|
|
|
export default{
|
|
|
setup() {
|
|
|
const state = reactive({
|
|
|
@@ -55,25 +54,26 @@ export default{
|
|
|
:::demo
|
|
|
```html
|
|
|
<template>
|
|
|
-<nut-cell title="Custom Password Length" is-link @click="state.visible2 = true;"></nut-cell>
|
|
|
- <nut-short-password
|
|
|
- v-model="state.value2"
|
|
|
- v-model:visible="state.visible2"
|
|
|
- @focus="state.showKeyboard2 = true"
|
|
|
- :length="state.length"
|
|
|
- @complete="methods.complete"
|
|
|
- >
|
|
|
- </nut-short-password>
|
|
|
- <nut-number-keyboard
|
|
|
- v-model="state.value2"
|
|
|
- v-model:visible="state.showKeyboard2"
|
|
|
- @blur="state.showKeyboard2 = false"
|
|
|
- >
|
|
|
- </nut-number-keyboard>
|
|
|
+ <nut-cell title="Custom Password Length" is-link @click="state.visible2 = true;"></nut-cell>
|
|
|
+ <nut-short-password
|
|
|
+ v-model="state.value2"
|
|
|
+ v-model:visible="state.visible2"
|
|
|
+ @focus="state.showKeyboard2 = true"
|
|
|
+ :length="state.length"
|
|
|
+ @complete="methods.complete"
|
|
|
+ >
|
|
|
+ </nut-short-password>
|
|
|
+ <nut-number-keyboard
|
|
|
+ v-model="state.value2"
|
|
|
+ v-model:visible="state.showKeyboard2"
|
|
|
+ @blur="state.showKeyboard2 = false"
|
|
|
+ >
|
|
|
+ </nut-number-keyboard>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { reactive } from 'vue';
|
|
|
-import { Toast } from '@nutui/nutui';
|
|
|
+import { showToast } from '@nutui/nutui';
|
|
|
+import '@nutui/nutui/dist/packages/toast/style';
|
|
|
export default{
|
|
|
setup() {
|
|
|
const state = reactive({
|
|
|
@@ -84,7 +84,7 @@ export default{
|
|
|
});
|
|
|
const methods = {
|
|
|
complete(value: string) {
|
|
|
- proxy.$toast.text(value);
|
|
|
+ showToast.text(value);
|
|
|
},
|
|
|
};
|
|
|
return {
|
|
|
@@ -102,25 +102,26 @@ export default{
|
|
|
:::demo
|
|
|
```html
|
|
|
<template>
|
|
|
-<nut-cell title="Forget password" is-link @click="state.visible3 = true;"></nut-cell>
|
|
|
- <nut-short-password
|
|
|
- v-model="state.value3"
|
|
|
- v-model:visible="state.visible3"
|
|
|
- @focus="state.showKeyboard3 = true"
|
|
|
- @complete="methods.complete"
|
|
|
- @tips="methods.onTips"
|
|
|
- >
|
|
|
- </nut-short-password>
|
|
|
- <nut-number-keyboard
|
|
|
- v-model="state.value3"
|
|
|
- v-model:visible="state.showKeyboard3"
|
|
|
- @blur="state.showKeyboard3 = false"
|
|
|
- >
|
|
|
- </nut-number-keyboard>
|
|
|
+ <nut-cell title="Forget password" is-link @click="state.visible3 = true;"></nut-cell>
|
|
|
+ <nut-short-password
|
|
|
+ v-model="state.value3"
|
|
|
+ v-model:visible="state.visible3"
|
|
|
+ @focus="state.showKeyboard3 = true"
|
|
|
+ @complete="methods.complete"
|
|
|
+ @tips="methods.onTips"
|
|
|
+ >
|
|
|
+ </nut-short-password>
|
|
|
+ <nut-number-keyboard
|
|
|
+ v-model="state.value3"
|
|
|
+ v-model:visible="state.showKeyboard3"
|
|
|
+ @blur="state.showKeyboard3 = false"
|
|
|
+ >
|
|
|
+ </nut-number-keyboard>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { reactive } from 'vue';
|
|
|
-import { Toast } from '@nutui/nutui';
|
|
|
+import { showToast } from '@nutui/nutui';
|
|
|
+import '@nutui/nutui/dist/packages/toast/style';
|
|
|
export default{
|
|
|
setup() {
|
|
|
const state = reactive({
|
|
|
@@ -130,10 +131,10 @@ export default{
|
|
|
});
|
|
|
const methods = {
|
|
|
complete(value: string) {
|
|
|
- proxy.$toast.text(value);
|
|
|
+ showToast.text(value);
|
|
|
},
|
|
|
onTips() {
|
|
|
- Toast.text('Execute forgotten password logic');
|
|
|
+ showToast.text('Execute forgotten password logic');
|
|
|
},
|
|
|
};
|
|
|
return {
|
|
|
@@ -150,26 +151,27 @@ export default{
|
|
|
:::demo
|
|
|
```html
|
|
|
<template>
|
|
|
-<nut-cell title="Error Message" is-link @click="state.visible4 = true;"></nut-cell>
|
|
|
- <nut-short-password
|
|
|
- v-model="state.value4"
|
|
|
- v-model:visible="state.visible4"
|
|
|
- @focus="state.showKeyboard4 = true"
|
|
|
- :error-msg="state.errorMsg"
|
|
|
- @complete="methods.complete"
|
|
|
- @tips="methods.onTips"
|
|
|
- >
|
|
|
- </nut-short-password>
|
|
|
- <nut-number-keyboard
|
|
|
- v-model="state.value4"
|
|
|
- v-model:visible="state.showKeyboard4"
|
|
|
- @blur="state.showKeyboard4 = false"
|
|
|
- >
|
|
|
- </nut-number-keyboard>
|
|
|
+ <nut-cell title="Error Message" is-link @click="state.visible4 = true;"></nut-cell>
|
|
|
+ <nut-short-password
|
|
|
+ v-model="state.value4"
|
|
|
+ v-model:visible="state.visible4"
|
|
|
+ @focus="state.showKeyboard4 = true"
|
|
|
+ :error-msg="state.errorMsg"
|
|
|
+ @complete="methods.complete"
|
|
|
+ @tips="methods.onTips"
|
|
|
+ >
|
|
|
+ </nut-short-password>
|
|
|
+ <nut-number-keyboard
|
|
|
+ v-model="state.value4"
|
|
|
+ v-model:visible="state.showKeyboard4"
|
|
|
+ @blur="state.showKeyboard4 = false"
|
|
|
+ >
|
|
|
+ </nut-number-keyboard>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { reactive } from 'vue';
|
|
|
-import { Toast } from '@nutui/nutui';
|
|
|
+import { showToast } from '@nutui/nutui';
|
|
|
+import '@nutui/nutui/dist/packages/toast/style';
|
|
|
export default{
|
|
|
setup() {
|
|
|
const state = reactive({
|
|
|
@@ -180,10 +182,10 @@ export default{
|
|
|
});
|
|
|
const methods = {
|
|
|
complete(value: string) {
|
|
|
- proxy.$toast.text(value);
|
|
|
+ showToast.text(value);
|
|
|
},
|
|
|
onTips() {
|
|
|
- Toast.text('Execute forgotten password logic');
|
|
|
+ showToast.text('Execute forgotten password logic');
|
|
|
},
|
|
|
};
|
|
|
return {
|