import { VantComponent } from '../common/component';
VantComponent({
props: {
title: String,
value: String,
loading: Boolean,
itemHeight: {
type: Number,
value: 44
},
visibleItemCount: {
type: Number,
value: 5
},
columnsNum: {
type: [String, Number],
value: 3
},
areaList: {
type: Object,
value: {}
}
},
data: {
pickerValue: [0, 0, 0],
columns: []
},
computed: {
displayColumns: function displayColumns() {
var _this$data = this.data,
_this$data$columns = _this$data.columns,
columns = _this$data$columns === void 0 ? [] : _this$data$columns,
columnsNum = _this$data.columnsNum;
return columns.slice(0, +columnsNum);
}
},
watch: {
value: function value(_value) {
this.code = _value;
this.setValues();
},
areaList: 'setValues'
},
methods: {
onCancel: function onCancel() {
this.$emit('cancel', {
values: this.getValues(),
indexs: this.getIndexs()
});
},
onConfirm: function onConfirm() {
this.$emit('confirm', {
values: this.getValues(),
indexs: this.getIndexs()
});
},
onChange: function onChange(event) {
var value = event.detail.value;
var _this$data2 = this.data,
pickerValue = _this$data2.pickerValue,
displayColumns = _this$data2.displayColumns;
var index = pickerValue.findIndex(function (item, index) {
return item !== value[index];
});
var values = displayColumns[index];
if (!value[index] || !values[value[index]]) {
return;
}
this.code = values[value[index]].code;
this.setValues();
this.$emit('change', {
picker: this,
values: this.getValues(),
index: index
});
},
getList: function getList(type, code) {
var result = [];
if (type !== 'province' && !code) {
return result;
}
var list = this.data.areaList && this.data.areaList[type + "_list"] || {};
result = Object.keys(list).map(function (code) {
return {
code: code,
name: list[code]
};
});
if (code) {
result = result.filter(function (item) {
return item.code.indexOf(code) === 0;
});
}
return result;
},
getIndex: function getIndex(type, code) {
var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
var list = this.getList(type, code.slice(0, compareNum - 2));
code = code.slice(0, compareNum);
for (var i = 0; i < list.length; i++) {
if (list[i].code.slice(0, compareNum) === code) {
return i;
}
}
return 0;
},
setValues: function setValues() {
var code = this.code || this.data.areaList && Object.keys(this.data.areaList.county_list || {})[0] || '';
var province = this.getList('province');
var city = this.getList('city', code.slice(0, 2));
this.setData({
'columns[0]': province,
'columns[1]': city
});
if (city.length && code.slice(2, 4) === '00') {
code = city[0].code;
}
this.setData({
'columns[2]': this.getList('county', code.slice(0, 4)),
pickerValue: [this.getIndex('province', code), this.getIndex('city', code), this.getIndex('county', code)]
});
},
getValues: function getValues() {
var _this$data3 = this.data,
_this$data3$displayCo = _this$data3.displayColumns,
displayColumns = _this$data3$displayCo === void 0 ? [] : _this$data3$displayCo,
_this$data3$pickerVal = _this$data3.pickerValue,
pickerValue = _this$data3$pickerVal === void 0 ? [] : _this$data3$pickerVal;
return displayColumns.map(function (option, index) {
return option[pickerValue[index]];
});
},
getIndexs: function getIndexs() {
var _this$data4 = this.data,
pickerValue = _this$data4.pickerValue,
columnsNum = _this$data4.columnsNum;
return pickerValue.slice(0, columnsNum);
},
reset: function reset() {
this.code = '';
this.setValues();
}
}
});
没有合适的资源?快使用搜索试试~ 我知道了~
微信小程序·云开发 数据库实战
共243个文件
js:63个
wxss:53个
json:53个
0 下载量 9 浏览量
2024-05-17
10:26:12
上传
评论
收藏 216KB ZIP 举报
温馨提示
一个数据库实战项目需要以下几个步骤: 1.需求分析:明确项目的目标和实现需求,包括数据库表结构设计、数据类型、数据关系和业务逻辑等方面。 2.数据库设计:根据需求分析确定的表结构设计,建立数据库模型,包括ER图、表结构图和视图等。 3.数据库编程:根据需求分析和数据库设计的结果,编写相关的数据库程序,包括存储过程、触发器和函数等。 4.测试和调试:对完成的数据库程序进行测试和调试,确保其功能正常、性能稳定、安全可靠。 5.部署和维护:将完成的数据库程序部署到服务器上,对其进行监控和维护,及时处理出现的问题和异常情况
资源推荐
资源详情
资源评论
收起资源包目录
微信小程序·云开发 数据库实战 (243个子文件)
config 325B
description 73B
exclude 240B
.gitignore 604B
.gitignore 604B
HEAD 209B
HEAD 209B
HEAD 32B
HEAD 23B
pack-4f628b51c43de7ca9ce7f6f3038f72ee33832171.idx 8KB
index 27KB
index.js 4KB
index.js 4KB
index.js 4KB
index.js 3KB
index.js 2KB
index.js 2KB
index.js 2KB
toast.js 2KB
index.js 2KB
index.js 2KB
index.js 2KB
dialog.js 2KB
index.js 2KB
index.js 2KB
info.js 2KB
complex.js 2KB
index.js 1KB
component.js 1KB
index.js 1KB
index.js 1KB
index.js 1KB
add.js 1KB
index.js 1KB
transition.js 1KB
index.js 990B
index.js 985B
index.js 965B
behavior.js 940B
index.js 907B
index.js 894B
index.js 888B
index.js 872B
index.js 834B
index.js 808B
index.js 744B
index.js 736B
index.js 725B
index.js 722B
touch.js 721B
class-names.js 684B
basic.js 679B
regex.js 658B
open-type.js 639B
index.js 630B
index.js 621B
index.js 613B
notify.js 592B
props.js 588B
button.js 520B
index.js 505B
index.js 502B
index.js 482B
index.js 367B
home.js 338B
index.js 306B
index.js 287B
app.js 269B
index.js 264B
index.js 236B
index.js 235B
utils.js 221B
index.js 154B
index.js 150B
package-lock.json 14KB
package-lock.json 14KB
project.config.json 1KB
app.json 414B
package-lock.json 283B
package.json 276B
package.json 276B
package.json 270B
index.json 216B
index.json 166B
info.json 156B
index.json 133B
index.json 130B
index.json 128B
index.json 126B
index.json 122B
complex.json 108B
index.json 102B
index.json 102B
index.json 96B
index.json 96B
index.json 96B
index.json 94B
index.json 94B
index.json 90B
index.json 90B
共 243 条
- 1
- 2
- 3
资源评论
小鹏linux
- 粉丝: 5w+
- 资源: 492
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功