12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- // components/select/select.js
- // https://www.cnblogs.com/zjjDaily/p/9548433.html
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- options: {
- type: Array,
- value: []
- },
- selectShow: {
- type: Boolean,
- value: false
- }
- },
- /**
- * 组件的初始数据
- */
- data: {
- content: '',
- },
- /**
- * 组件的方法列表
- */
- methods: {
- //option的显示与否
- selectToggle: function () {
- this.setData({
- selectShow: !this.data.selectShow
- })
- },
- //设置内容
- selectTap: function (e) {
- const {info} = e.target.dataset;
- this.setData({
- selectShow: false,
- content: info.label
- })
- this.triggerEvent('change', info);
- }
- }
- })
|