123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- // components/autoAdd/index.js
- import international from '../../international/appointment_scence/index'
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- // 显示标题
- label: {
- type: String,
- value: '受邀人员'
- },
- //placeholder
- placeholder: {
- type: String,
- value: '请输入手机号'
- },
- language: {
- type: String,
- value: 'ch'
- },
- showAddBut:{
- type:Boolean,
- },
- closeNum:{
- type:false,
- },
-
- },
- /**
- * 组件的初始数据
- */
- data: {
- international: international, //国际化语言包
- list: [''],
- },
- /**
- * 组件的方法列表
- */
- methods: {
- // 增加一行
- add(e) {
- var {
- list
- } = this.data;
- list.push('');
- this.setData({
- list
- })
- },
- //删除一行
- delete(e) {
- var {
- list
- } = this.data;
- list.splice(e.currentTarget.dataset.index, 1);
- this.setData({
- list
- })
- },
- //获得用户输入
- getValue(e) {
- var {
- list
- } = this.data;
- var index = "list[" + e.currentTarget.dataset.index + "]"
- this.setData({
- [index] : e.detail.value
- })
- list = list.filter((value) => {
- if (value != '') {
- return value
- }
- });
- if(e.detail.value.length >= 11) {
- wx.hideKeyboard()
- }
- this.triggerEvent('change', Array.from(new Set(list)))
- },
- },
- observers: {
- 'showAddBut': function(showAddBut) {
- if(!showAddBut){
- this.setData({
- list: [''],
- })
- }
- },
- 'closeNum':function(closeNum){
- if(closeNum){
- this.setData({
- list: [''],
- })
- }
- }
- }
- })
|