123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- // components/w-search/index.ts
- Component({
- options: {
- multipleSlots: true,
- styleIsolation: "shared",
- },
- /**
- * 组件的属性列表
- */
- properties: {
- /**
- * 搜索框的值
- */
- value: {
- type: String,
- value: "",
- observer: '_value'
- },
- /**
- * 搜索框的占位符
- */
- placeholder: {
- type: String,
- value: "请输入搜索内容",
- },
- // 搜索框的占位符样式
- placeholderStyle: {
- type: String,
- value: "color: #BDBDBD;",
- },
- searchButtonText: {
- type: String,
- value: "搜索",
- },
- /**
- * 输入框的背景色 - 默认白色, [white gray]
- */
- backgroundClass: {
- type: String,
- value: 'white'
- }
- },
- /**
- * 组件的初始数据
- */
- data: {
- searchName: ""
- },
- /**
- * 组件的方法列表
- */
- methods: {
- onSearchChange(event: any) {
- this.setData({
- value: event.detail,
- });
- this.triggerEvent("change", event.detail);
- },
- onSearch() {
- // this.getSchools(this.data.searchName);
- this.triggerEvent("search", this.data.searchName)
- },
- _value() {
- this.setData({
- searchName: this.data.value
- })
- }
- },
- });
|