Browse Source

Merge branch 'next' of https://github.com/jdf2e/nutui into next

zhenyulei 5 years ago
parent
commit
a0ae2135d4

+ 12 - 0
src/packages/input/demo.vue

@@ -0,0 +1,12 @@
+<template>
+    <div class="demo-list"></div>
+</template>
+<script>
+export default {
+    data() {
+        return {};
+    },
+    methods: {
+    }
+}
+</script>

+ 30 - 0
src/packages/input/doc.md

@@ -0,0 +1,30 @@
+| 参数         | 说明                             | 类型   | 默认值           |
+|--------------|----------------------------------|--------|------------------|
+| type         | 类型,可选值为 `text` `textarea` `number`  等 | String |`text`         |
+| value      | 输入值,双向绑定 | String |  -     |
+| placeholder         | 为空时占位符 | String |       -       |
+| placeholder-style | placeholder 样式     | String | - |
+| label          | 	左侧文案                       | string | -             |
+| has-border          | 	是否有边框                       | booleab | true            |
+| disabled          | 	是否禁用                       | boolean | `false`              |
+| readonly          | 是否只读                        | boolean | `false`               |
+| clear-btn       | 是否带清除按钮(icon)                        | boolean | `true`               |
+| required          | 是否带必填的*号,且blur事件做非空校验                       | boolean | `false`               |
+| maxlength          | 限制最长输入字符                   | string/number | -               |
+| limit-show          | textarea时是否展示输入字符。须设置maxlength                        | boolean | `false`               |
+
+
+事件
+| input          | 输入内容时触发                        | function | -               |
+| change          | 输入内容时触发                        | function | -               |
+| focus          | 聚焦时触发                        | function | -               |
+| blur          | 失焦时触发                        | function | -               |
+| clear          | 点击清空时触发                        | function | -               |
+| error          | 校验错误时触发                        | function | -               |
+
+
+
+
+
+
+

+ 1 - 0
src/packages/input/index.scss

@@ -0,0 +1 @@
+.nut-temp {}

+ 43 - 0
src/packages/input/index.vue

@@ -0,0 +1,43 @@
+<template>
+		<view :class="classes" @click="handleClick">
+		  <view>{{ name }}</view>
+		  <view>{{ txt }}</view>
+		</view>
+	  </template>
+	  <script lang="ts">
+	  import { toRefs } from 'vue';
+	  import { createComponent } from '@/utils/create';
+	  const { componentName, create } = createComponent('temp');
+	  
+	  export default create({
+		props: {
+		  name: {
+			type: String,
+			default: ''
+		  },
+		  txt: {
+			type: String,
+			default: ''
+		  }
+		},
+		components: {},
+		emits: ['click'],
+	  
+		setup(props, { emit }) {
+		  console.log('componentName', componentName);
+	  
+		  const { name, txt } = toRefs(props);
+	  
+		  const handleClick = (event: Event) => {
+			emit('click', event);
+		  };
+	  
+		  return { name, txt, handleClick };
+		}
+	  });
+	  </script>
+	  
+	  <style lang="scss">
+	  @import 'index.scss';
+	  </style>
+