12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- // components/radioGroup/index.js
- Component({
- options: {
- lifetimes: true
- },
- /**
- * 组件的属性列表
- */
- properties: {
- //选项列表
- list: {
- type: Array,
- value: []
- },
- //显示的label的key
- labelKey: {
- type: String,
- value: null
- },
- //取值的value的key
- valueKey: {
- type: String,
- value: "id"
- },
- // 默认值
- value: null,
- isAudit: {
- type: Boolean,
- value: false
- }
- },
- /**
- * 组件的初始数据
- */
- data: {},
- lifetimes: {
- attached() {
- const { value } = this.data;
- if (value != null) {
- this.triggerEvent("change", value);
- }
- }
- },
- /**
- * 组件的方法列表
- */
- methods: {
- onChange(e) {
- this.setData({
- value: e.detail
- })
- this.triggerEvent("change", e.detail);
- }
- }
- });
|