| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- // components/remotePicker/remotePicker.js
- import {
- postApi
- } from "../../apis/api"
- Component({
- properties: {
- url: {
- type: String
- },
- params: {
- type: Object
- },
- inputStyle: {
- type: String
- },
- scrollStyle:{
- type: String
- },
- disabled: {
- type: Boolean
- },
- value: {
- type: String || Number
- },
- label: {
- type: String
- },
- placeholder: {
- type: String
- },
- },
- data: {
- arr: [],
- },
- methods: {
- async _getList() {
- let res = await postApi(this.data.url, {
- ...this.data.params,
- term: this.data.label
- })
- this.setData({
- arr: res.data.result,
- label: ''
- })
- },
- _selectItem(e) {
- let {
- label,
- value
- } = e.currentTarget.dataset
- this.setData({
- label,
- value,
- arr: []
- })
- this.triggerEvent('selectItem', {
- label,
- value
- })
- },
- _handlerOne() {
- this.setData({
- arr: []
- })
- },
- },
- options: {
- styleIsolation: 'isolated'
- }
- })
|