| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <template>
- <view class="en-box">
- <input class="en-input sys-size-32 text-color-12 sys-weight-600"
- placeholder-class="sys-size-28 text-color-999 sys-weight-400" :maxlength="maxlength" :type="type"
- :focus="focus" :placeholder="placeholder ? placeholder : ''" :disabled="!!disabled" v-model="inputValue"
- @blur="nameInput" @input="nameInput"></input>
- </view>
- </template>
- <script>
- export default {
- name: 'en-input',
- props: {
- type: {
- type: String,
- default: 'text'
- },
- placeholder: {
- type: String,
- default: '请输入'
- },
- disabled: {
- default: false
- },
- name: {
- type: String,
- default: 'text'
- },
- value: {
- default: ''
- },
- maxlength: {
- default: 140
- },
- focus: {
- default: false
- }
- },
- data() {
- return {
- inputValue: '',
- showShake: false
- };
- },
- watch: {
- 'value': function() {
- if (this.inputValue !== this.value) {
- this.inputValue = this.value
- }
- },
- 'inputValue': function() {
- this.$emit('input', this.inputValue)
- }
- },
- mounted() {
- this.inputValue = this.value
- },
- methods: {
- nameInput(e) {
- if (this.type === 'nickname') {
- this.inputValue = e.detail.value
- }
- },
- }
- }
- </script>
- <style lang="scss">
- .en-input {
- .en-input {
- width: 100%;
- }
- .en-input-placeholder {
- color: #999999;
- font-size: 28rpx;
- }
- }
- </style>
|