如何在ionic2中以单行添加图标按钮标签和输入?

时间:2017-02-11 19:11:06

标签: angular input ionic2

在暂停代码中,我尝试将3个元素添加到一起,但它失败并且按钮未在输出中显示

<ion-content>
  <ion-item>
    <ion-label fixed>Origin</ion-label>
    <ion-input type="text" value=""></ion-input>
    <ion-buttons end>
      <button ion-button icon-only>
        <ion-icon name="locate"></ion-icon>
      </button>
    </ion-buttons>
  </ion-item>

  <ion-item>
    <ion-label fixed>Target</ion-label>
    <ion-input type="text" value=""></ion-input>
    <ion-buttons end>
      <button ion-button icon-only>
        <ion-icon name="locate"></ion-icon>
      </button>
    </ion-buttons>
  </ion-item>
<button ion-button full>Start</button>
</ion-content>

它分别显示每个项目或带有标签的文本,但按钮没有显示在文本框的末尾。

1 个答案:

答案 0 :(得分:1)

这样做的一种方法是使用ion-row,ion-col以您需要的格式进行排列。检查here 例如:

from tkinter import *
import requests
from lxml import html

window = Tk()
window.title('Craigslist Apartment Finder')
window.resizable(width=False, height=True)

def getSearch():
    s1 = searchterm1.get()
    s2 = searchterm2.get()
    s3 = searchterm3.get()

    if s1 != "":
        url = "https://newyork.craigslist.org/search/brk/roo?sort=date&availabilityMode=0&query=" + s1
    if s2 != "":
        url = url + "+" + s2
    if s3 != "":
        url = url + "+" + s3
    if s1 != "" or s2 != "" or s3 != "":
        print(url)
    else:
        print("No search terms entered.")

    page = requests.get(url)
    print(page)
    tree = html.fromstring(page.content)

    price = tree.xpath('//span[class="result-price"]/text()')

    print("Prices:", price)

searchterm1 = Entry(window)
searchterm2 = Entry(window)
searchterm3 = Entry(window)

programname = Label(window, text="Apartment Finder")
runbutton = Button(window, text="Run", bg="green", fg="white",  width=10, command=getSearch)

displayurl = Label(window, text="url")
programname.grid(row=0, column=0, columnspan=2)
runbutton.grid(row=0, column=2)
searchterm1.grid(row=1, column=0)
searchterm2.grid(row=1, column=1)
searchterm3.grid(row=1, column=2)
displayurl.grid(row=2, column=0, columnspan=3)

window.mainloop()