123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- // components/w-radio/index.ts
- Component({
- options: {
- multipleSlots: true,
- styleIsolation: "shared"
- },
- /**
- * 组件的属性列表
- */
- properties: {
- value: {
- type: [String, Number] as any,
- value: '',
- observer: '_value'
- },
- /** 选项值 */
- options: {
- type: Array,
- value: []
- },
- /** 排列方向,可选值为 vertical horizontal */
- direction: {
- type: String,
- value: "horizontal",
- },
- },
- /**
- * 组件的初始数据
- */
- data: {
- innerValue: ''
- },
- /**
- * 组件的方法列表
- */
- methods: {
- onCheckChange(event: { detail: any }) {
- const value = event.detail
- this.setData({
- value: value
- })
- this.triggerEvent('input', value)
- },
- _value() {
- this.setData({
- innerValue: this.data.value
- })
- }
- }
- })
|