RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-513070

avldokuchaev's questions

Martin Hope
avldokuchaev
Asked: 2023-07-06 21:31:37 +0000 UTC

如何在 swiftui + firebase 应用程序中按城市过滤

  • 5

我有一个使用 firebase 的 swiftui 应用程序。我想在向用户发布帖子时按城市进行过滤。为此,我将城市参数添加到 firebase 集合中。然后我想使用 whereField 向用户显示,但由于某种原因什么也没有发生。这是我的代码:

    struct ReusablePostViewContentView: View {
    
    var cities = ["Москва", "Волгоград", "Пермь"]
    
    @State private var selectedCity: String = "Москва"
    
    @Binding var posts: [Post]
    
    @State private var isFetching: Bool = true
    
    @State private var paginationDoc: QueryDocumentSnapshot?
    
    var body: some View {
    
    Picker("Выберите город", selection: $selectedCity) {
                    
                    ForEach(cities, id: \.self) {
    
                        Text($0)
                    }
                }

         ScrollView(.vertical, showsIndicators: false) {
            LazyVStack {
                if isFetching {
                    ProgressView()
                        .padding(.top, 30)
                } else {
                    if posts.isEmpty {
                        Text("Записи отсутствуют")
                            .font(.caption)
                            .foregroundColor(.gray)
                            .padding(.top, 30)
                    } else {
                        Posts()
                    }
                }
            }
            .padding(15)
        }
        .refreshable {
         
            isFetching = true
            posts = []
            paginationDoc = nil
            await fetchPosts()
        }
        .task {
            guard posts.isEmpty else {return}
            await fetchPosts()
        }
        }

    }

func Posts() -> some View {
        ForEach (posts) { post in
        
            PostCardViewContentViewFish(post: post) { updatedPost in
                if let index = posts.firstIndex(where: { post in
                    post.id == updatedPost.id
                }) {
                    posts[index].likedIDs = updatedPost.likedIDs
                    posts[index].dislikedIDs = updatedPost.dislikedIDs
                }
            } onDelete: {
                withAnimation(.easeInOut(duration: 0.25)) {
                    posts.removeAll {post.id == $0.id}
                }
            }
            .onAppear {
                if post.id == posts.last?.id && paginationDoc != nil {
                    Task {await fetchPosts()}
                 
                }
            }
            
            Divider()
                .padding(.horizontal, -15)

        }
    }
    
    func fetchPosts() async {
            do {
                var query: Query!
                if let paginationDoc {
                    query = Firestore.firestore().collection("Posts")
                        .whereField("yourCity", isEqualTo: selectedCity)
                        .order(by: "upPostPlusDayValueCount", descending: true)
                        .start(afterDocument: paginationDoc)
                        .limit(to: 5)
                } else {
                    query = Firestore.firestore().collection("Posts")
                        .whereField("yourCity", isEqualTo: selectedCity)
                        .order(by: "upPostPlusDayValueCount", descending: true)
                        .limit(to: 5)
                }
                
                let docs = try await query.getDocuments()
                let fetchedPosts = docs.documents.compactMap { doc -> Post? in
                    try? doc.data(as: Post.self)
                }
                await MainActor.run(body: {
                    posts.append(contentsOf: fetchedPosts) 
                    
                    paginationDoc = docs.documents.last
                  
                    isFetching = false
                })
            } catch {
                print(error.localizedDescription)
            }
        }
    }
ios
  • 1 个回答
  • 9 Views
Martin Hope
avldokuchaev
Asked: 2023-06-04 07:03:08 +0000 UTC

当文档的创建时间与今天的日期不同时,如何编写一个函数从 firebase 中删除数据?

  • 5

我有一个使用 firebase 的 swiftui 应用程序。

创建文档时,数据库中存储了 2 个可选参数:一个数组upPostPlusDay和一个计数器upPostPlusDayValueCount,以及创建文档的日期publishedDate( timestamp)。

请帮我写一个函数,如果文档创建日期和今天的日期有差异,例如7天,数组值将被删除,计数器值将被重置。

一个数组只能包含一个值。

这是将参数写入数据库的模型代码:

import SwiftUI
import FirebaseFirestoreSwift

struct Post: Identifiable, Codable, Equatable, Hashable {
    @DocumentID var id: String?
    var text: String
    var postHead: String
    var postAddress: String
    var imageURL: URL?
    var imageReferenceID: String = ""
    var publishedDate: Date = Date()
    var likedIDs: [String] = []
    var dislikedIDs: [String] = []
    var plusFavorites: [String] = []
    var upPostPlusDay: [Int] = []
    var upPostPlusDayValueCount: Double = 0
    var userName: String
    var userUID: String
    var userProfileURL: URL
    var userBioLink: String
    
    enum CodingKeys: CodingKey {
        case id
        case text
        case postHead
        case postAddress
        case imageURL
        case imageReferenceID
        case publishedDate
        case likedIDs
        case dislikedIDs
        case plusFavorites
        case upPostPlusDay
        case upPostPlusDayValueCount
        case userName
        case userUID
        case userProfileURL
        case userBioLink
    }
}
firebase
  • 1 个回答
  • 18 Views
Martin Hope
avldokuchaev
Asked: 2023-03-29 20:05:40 +0000 UTC

选择特定的选择器值时如何使文本字段自动更改

  • 5

请告诉我如何做到当从 Picker 字段中选择某个值时,Text 字段中的结果会自动更改。我写了代码,但它给出了一个错误 Type '()' cannot conform to 'View'。这是代码:

import SwiftUI

struct ContentView: View {
    
    @State private var years: [String] = ["2010", "2011", "2012"]
    @State private var selectedYearIndex = 2
    @State private var resultText = ""
    
    
    var body: some View {
        
        switch selectedYearIndex {
        case 0:
            self.resultText = "Hello"
        case 1:
            self.resultText = "Hi"
        case 2:
            self.resultText = "Bye"
        default:
            self.resultText = "No"
        }
        
        VStack {
            Text("Result Text:")
            Spacer()
            Text("\(resultText)")
            Spacer()
            
            Picker("Choose a Year", selection: $selectedYearIndex) {
                
                ForEach(0..<years.count) {
                    Text("\(years[$0])").font(.title)
                }
                
            }
            
        }
    }
}
swift
  • 1 个回答
  • 15 Views
Martin Hope
avldokuchaev
Asked: 2023-02-12 07:35:23 +0000 UTC

如何访问 SwiftUI 中的背景按钮图像?

  • 6

我正在尝试在 SwiftUI 中重写一个应用程序。在此之前,它是在故事板中完成的。该应用程序使用按钮实现横幅旋转器。这是代码:'''

import UIKit

class NavigteViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        let images = [UIImage(named: "Agrokomplexshop"), UIImage(named: "allradru"), UIImage(named: "Baggins"), UIImage(named: "Bestwatch"), UIImage(named: "Blackwoodbag"), UIImage(named: "CDEK"), UIImage(named: "Credit7RU"), UIImage(named: "cvetDivanov"), UIImage(named: "europamarket"), UIImage(named: "fitstars"), UIImage(named: "growfood"), UIImage(named: "Iskussnica"), UIImage(named: "kolesaDarom"), UIImage(named: "Letbefit"), UIImage(named: "LevelKitchen"), UIImage(named: "MadWave"), UIImage(named: "Mealjoyru"), UIImage(named: "MoskovskayaMehovayaKompaniya"), UIImage(named: "NFONorwegianFishOil"), UIImage(named: "OKBeauty"), UIImage(named: "Petrolplus"), UIImage(named: "Pichshop"), UIImage(named: "Pizzaallo"), UIImage(named: "playtoday"), UIImage(named: "Pokrishka"), UIImage(named: "Polis812RU"), UIImage(named: "ProfmaxPro"), UIImage(named: "Randewoo"), UIImage(named: "RenessansJiznRU"), UIImage(named: "rerooms"), UIImage(named: "Rockyshop"), UIImage(named: "sbermarket"), UIImage(named: "Shopneoline"), UIImage(named: "Smallcitysu"), UIImage(named: "Smartwaytoday"), UIImage(named: "sohoshop"), UIImage(named: "Sprinthost"), UIImage(named: "SuperStepRU"), UIImage(named: "TheFurnish"), UIImage(named: "ugindoma"), UIImage(named: "VKMuzika"), UIImage(named: "Vprokru"), UIImage(named: "YandexBuisnessRU"), UIImage(named: "yandexgodlyabiznesa"), UIImage(named: "zaochnik"), UIImage(named: "ZettaStrhovanieRU"), UIImage(named: "zoomag"), UIImage(named: "zooptorgrf"), UIImage(named: "AlfaBankCreditnieKartiRU"), UIImage(named: "aliexpress"), UIImage(named: "alter"), UIImage(named: "autoall"), UIImage(named: "autopiter"), UIImage(named: "Bbcream"), UIImage(named: "calltouch"), UIImage(named: "cantra"), UIImage(named: "CherehapaRU"), UIImage(named: "GeekBrains"), UIImage(named: "productstar"), UIImage(named: "Promomegafitpro"), UIImage(named: "puzzlemovies"), UIImage(named: "RBKPro"), UIImage(named: "skypro"), UIImage(named: "Tetrikaschool"), UIImage(named: "Ukassa"), UIImage(named: "Vipfish"), UIImage(named: "YESEducationGroup")]
        
        let imag = images.randomElement()
        
        bunnerImageBackground.setImage((imag as! UIImage) , for: .normal)
    }
    
    
    @IBOutlet weak var bunnerImageBackground: UIButton!
    
    
    
    @IBAction func bunner(_ sender: Any) {
        
        let imagesfor = [UIImage(named: "Agrokomplexshop"), UIImage(named: "allradru"), UIImage(named: "Baggins"), UIImage(named: "Bestwatch"), UIImage(named: "Blackwoodbag"), UIImage(named: "CDEK"), UIImage(named: "Credit7RU"), UIImage(named: "cvetDivanov"), UIImage(named: "europamarket"), UIImage(named: "fitstars"), UIImage(named: "growfood"), UIImage(named: "Iskussnica"), UIImage(named: "kolesaDarom"), UIImage(named: "Letbefit"), UIImage(named: "LevelKitchen"), UIImage(named: "MadWave"), UIImage(named: "Mealjoyru"), UIImage(named: "MoskovskayaMehovayaKompaniya"), UIImage(named: "NFONorwegianFishOil"), UIImage(named: "OKBeauty"), UIImage(named: "Petrolplus"), UIImage(named: "Pichshop"), UIImage(named: "Pizzaallo"), UIImage(named: "playtoday"), UIImage(named: "Pokrishka"), UIImage(named: "Polis812RU"), UIImage(named: "ProfmaxPro"), UIImage(named: "Randewoo"), UIImage(named: "RenessansJiznRU"), UIImage(named: "rerooms"), UIImage(named: "Rocky-shop"), UIImage(named: "sbermarket"), UIImage(named: "Shopneoline"), UIImage(named: "Smallcitysu"), UIImage(named: "Smartwaytoday"), UIImage(named: "sohoshop"), UIImage(named: "Sprinthost"), UIImage(named: "SuperStepRU"), UIImage(named: "TheFurnish"), UIImage(named: "ugindoma"), UIImage(named: "VKMuzika"), UIImage(named: "Vprokru"), UIImage(named: "YandexBuisnessRU"), UIImage(named: "yandexgodlyabiznesa"), UIImage(named: "zaochnik"), UIImage(named: "ZettaStrhovanieRU"), UIImage(named: "zoomag"), UIImage(named: "zooptorgrf"), UIImage(named: "AlfaBankCreditnieKartiRU"), UIImage(named: "aliexpress"), UIImage(named: "alter"), UIImage(named: "autoall"), UIImage(named: "autopiter"), UIImage(named: "Bbcream"), UIImage(named: "calltouch"), UIImage(named: "cantra"), UIImage(named: "CherehapaRU"), UIImage(named: "GeekBrains"), UIImage(named: "productstar"), UIImage(named: "Promomegafitpro"), UIImage(named: "puzzlemovies"), UIImage(named: "RBKPro"), UIImage(named: "skypro"), UIImage(named: "Tetrikaschool"), UIImage(named: "Ukassa"), UIImage(named: "Vipfish"), UIImage(named: "YESEducationGroup")]
        
        
        switch bunnerImageBackground.currentImage {
            
        case imagesfor[0]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/lkj8u73nnd31225e5a7704cb4947eb/")!)
        case imagesfor[1]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/elgf718etq31225e5a770e020ad620/?erid=LatgBUcjU")!)
        case imagesfor[2]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/m33u5flihp31225e5a7787b20ecef3/?erid=LatgBgkRu")!)
        case imagesfor[3]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/7d074b20eb31225e5a7777d7343c30/?erid=LatgBiNsP")!)
        case imagesfor[4]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/n90gqfg8zz31225e5a7768b0e348e3/?erid=LatgBs8Xq")!)
        case imagesfor[5]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/8m5m8022me31225e5a77fa1399d1cb/")!)
        case imagesfor[6]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/vojb18n6gs31225e5a7796bf0d7973/?erid=LatgBnShk")!)
        case imagesfor[7]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/67570bafb631225e5a7766146bcf1d/")!)
        case imagesfor[8]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/yh7dxsl4ze31225e5a770d5c628f32/?erid=LatgBk5GN")!)
        case imagesfor[9]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/lcz5l7shqa31225e5a77253f07e8f6/")!)
        case imagesfor[10]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/36wusytszy31225e5a77aeb982cd0a/")!)
        case imagesfor[11]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/er5wwbo0j631225e5a77f665c6f820/")!)
        case imagesfor[12]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/phemb8m2uc31225e5a77ccd85565ce/?erid=LatgCAysS")!)
        case imagesfor[13]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/qm29jzxwek31225e5a77fcd3300043/")!)
        case imagesfor[14]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/u7cz7332nc31225e5a77738d825a2a/")!)
        case imagesfor[15]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/02ocqj6mtr31225e5a7702f7474c98/?erid=LatgBxmTS")!)
        case imagesfor[16]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/ml2h339a7u31225e5a77c9dd5f6bbc/")!)
        case imagesfor[17]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/06d83a456331225e5a77c6abdc5353/")!)
        case imagesfor[18]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/l604dr7c1e31225e5a779c176d7edf/?erid=LatgBome6")!)
        case imagesfor[19]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/nl23vc8ifb31225e5a7753b0491767/?erid=LatgBpT4S")!)
        case imagesfor[20]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/ib927vcr1x31225e5a77fdbdccbe6f/?erid=LatgBxrwE")!)
        case imagesfor[21]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/balo8rex4231225e5a77a28df5fc31/?erid=LatgC9HFD")!)
        case imagesfor[22]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/bgi1r32ntf31225e5a77b0f1f587ba/")!)
        case imagesfor[23]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/ibbrr5pyi831225e5a7778ec4c4caa/")!)
        case imagesfor[24]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/bw09hq1psa31225e5a77729032ae9b/?erid=LatgBtona")!)
        case imagesfor[25]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/m7xuhz7ysw31225e5a77440db5965d/")!)
        case imagesfor[26]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/d2y1qd8flb31225e5a7739152ee3f6/?erid=LatgBhUb7")!)
        case imagesfor[27]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/efixkgr4c431225e5a770dd11956d5/")!)
        case imagesfor[28]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/9qw2p1opbr31225e5a77e76cad6e67/?erid=LatgBgjtz")!)
        case imagesfor[29]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/5nilvc2n6731225e5a77592052c97a/?erid=LatgBbjCK")!)
        case imagesfor[30]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/lrpvclu24w31225e5a77be166c0a8b/?erid=LatgBeihm")!)
        case imagesfor[31]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/ugldybr34d31225e5a77326cfdd537/?erid=LatgBYJCD")!)
        case imagesfor[32]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/pi8gje4m1p31225e5a771c454c946b/?erid=LatgBso7Y")!)
        case imagesfor[33]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/vwrmyws33j31225e5a77d720df3727/?erid=LatgBnrbd")!)
        case imagesfor[34]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/c2jesykfil31225e5a7792877be4a1/?erid=LatgCB1Es")!)
        case imagesfor[35]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/x5npm7rr8e31225e5a77e6dc21c9f7/")!)
        case imagesfor[36]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/mxmtlx74bh31225e5a77b183dfeeb8/?erid=LatgByErP")!)
        case imagesfor[37]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/enml32rwhr31225e5a77a814938f71/?erid=LatgBXe4u")!)
        case imagesfor[38]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/e119380ec031225e5a7775922924c2/?erid=LatgBVe6K")!)
        case imagesfor[39]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/5ypaik84gp31225e5a77069ee805e1/?erid=LatgBVKg8")!)
        case imagesfor[40]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/dnezl2xu4131225e5a77af54ab86e0/")!)
        case imagesfor[41]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/paesexo5wj31225e5a77aa88a5b1cc/")!)
        case imagesfor[42]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/tsur35yw0t31225e5a77ff277dce71/")!)
        case imagesfor[43]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/kzlcevsny831225e5a7784814a437b/")!)
        case imagesfor[44]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/sk55otxguo31225e5a776853a97b34/?erid=LatgBb6k3")!)
        case imagesfor[45]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/27wmm2ciw331225e5a774d3555d70b/?erid=LatgBTy98")!)
        case imagesfor[46]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/m7bdjiij7e31225e5a7745912f3e2d/?erid=LatgCAHzf")!)
        case imagesfor[47]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/rvcnriueyx31225e5a77e22b63c9b7/?erid=LatgC9HKd")!)
        case imagesfor[48]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/i352cbwpfv31225e5a771cb5598fff/")!)
        case imagesfor[49]:
            UIApplication.shared.open(URL(string: "https://alitems.co/g/vv3q4oey1v31225e5a77b6d1781017/")!)
        case imagesfor[50]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/fxysja9qse31225e5a776704bcdbc1/?erid=LatgC1bqD")!)
        case imagesfor[51]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/5rermd1rb531225e5a77aeed5c54e0/?erid=LatgBk8mS")!)
        case imagesfor[52]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/1hedtmqch531225e5a771423f7dae0/?erid=LatgBpn1Q")!)
        case imagesfor[53]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/9l1uizc2km31225e5a771bd767fd6d/?erid=LatgBYK7C")!)
        case imagesfor[54]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/y3x3cfffmv31225e5a77f6ebb01ee1/?erid=LatgC3YPC")!)
        case imagesfor[55]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/ezmwtz3pov31225e5a7785aed9e6f6/?erid=LatgBaf2A")!)
        case imagesfor[56]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/2ey5h355qu31225e5a771e9ee21cc3/?erid=LatgBpnvS")!)
        case imagesfor[57]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/k3dfvevwit31225e5a7765a37ca03d/")!)
        case imagesfor[58]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/t9pnpumx6q31225e5a775e445e6c7b/?erid=LatgC7JZZ")!)
        case imagesfor[59]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/ehygr1fnh831225e5a77ed7d1ea7c0/?erid=LatgBtjgG")!)
        case imagesfor[60]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/ae4zpznc0i31225e5a7742f9f2178b/?erid=LatgC5CoU")!)
        case imagesfor[61]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/hmgfm467d731225e5a774c86cb021e/?erid=LatgC5eJ7")!)
        case imagesfor[62]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/kpr3e0qpel31225e5a775eaaeb7930/?erid=LatgBtSwH")!)
        case imagesfor[63]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/54h3zonoi631225e5a7794d0e5a27a/")!)
        case imagesfor[64]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/hlif2saueo31225e5a77dff88f55df/")!)
        case imagesfor[65]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/lqb6l7197z31225e5a7794cf89477e/")!)
        case imagesfor[66]:
            UIApplication.shared.open(URL(string: "https://aflink.ru/g/tfogdtvvuf31225e5a772019e44728/")!)
         default:
            break
            
        }
       
        
    }
    
}

''' 现在如何在 SwiftUI 中实现它?我所做的一部分是在加载背景按钮时使图像随机。为此,我使用以下代码创建了一个单独的文件:'''

import SwiftUI
let images = [
Image("Agrokomplexshop"), Image("allradru"), Image("Baggins"), Image("Bestwatch"), Image("Blackwoodbag"), Image("CDEK"), Image("Credit7RU"), Image("cvetDivanov"), Image("europamarket"), Image("fitstars"), Image("growfood"), Image("Iskussnica"), Image("kolesaDarom"), Image("Letbefit"), Image("LevelKitchen"), Image("MadWave"), Image("Mealjoyru"), Image("MoskovskayaMehovayaKompaniya"), Image("NFONorwegianFishOil"), Image("OKBeauty"), Image("Petrolplus"), Image("Pichshop"), Image("Pizzaallo"), Image("playtoday"), Image("Pokrishka"), Image("Polis812RU"), Image("ProfmaxPro"), Image("Randewoo"), Image("RenessansJiznRU"), Image("rerooms"), Image("Rockyshop"), Image("sbermarket"), Image("Shopneoline"), Image("Smallcitysu"), Image("Smartwaytoday"), Image("sohoshop"), Image("Sprinthost"), Image("SuperStepRU"), Image("TheFurnish"), Image("ugindoma"), Image("VKMuzika"), Image("Vprokru"), Image("YandexBuisnessRU"), Image("yandexgodlyabiznesa"), Image("zaochnik"), Image("ZettaStrhovanieRU"), Image("zoomag"), Image("zooptorgrf"), Image("AlfaBankCreditnieKartiRU"), Image("aliexpress"), Image("alter"), Image("autoall"), Image("autopiter"), Image("Bbcream"), Image("calltouch"), Image("cantra"), Image("CherehapaRU"), Image("GeekBrains"), Image("productstar"), Image("Promomegafitpro"), Image("puzzlemovies"), Image("RBKPro"), Image("skypro"), Image("Tetrikaschool"), Image("Ukassa"), Image("Vipfish"), Image("YESEducationGroup")]

let imag = images.randomElement()

struct BunnerButton: ButtonStyle {
   
    func makeBody(configuration: Configuration) -> some View {
        configuration.label
        imag!
        .renderingMode(.original)
        .frame(width: 300, height: 38)
    }
}

''' 并为按钮添加样式:'''

Button("Реклама") {
            //action
           
            
        }
        .buttonStyle(BunnerButton())

''' 但是我不明白如何执行操作。请帮帮我。

swift
  • 1 个回答
  • 18 Views
Martin Hope
avldokuchaev
Asked: 2022-12-06 00:37:48 +0000 UTC

无法在新的视图控制器中编写代码

  • 5

我在 Storyboard 中创建了一个新的 View Controller,但我无法在其中编写代码。甚至 TextField 都不能连接到 Assistance。帮忙解决一个问题。

swift
  • 1 个回答
  • 16 Views
Martin Hope
avldokuchaev
Asked: 2022-08-01 17:36:31 +0000 UTC

在wordpress中显示js结果的问题

  • 0

wordpress中有js代码。当您单击该按钮时,结果会显示一秒钟并重新加载页面。怎么修?这是代码:

function func() {
  let exampleInputrost = Number(document.getElementById("exampleInputrost").value);
  let exampleInputves = Number(document.getElementById("exampleInputves").value);
  let doksorubicin = 60;
  let ciklophosphamid = 600;

  function square_body_chemotherapy(exampleInputrost, exampleInputves) {
    let weitfloatsquare = Math.pow(exampleInputrost, 0.5);
    let heightfloatsquare = Math.pow(exampleInputves, 0.5);
    let square_body = 0.0167 * weitfloatsquare * heightfloatsquare;
    return square_body.toFixed(1);
  }
  let res = square_body_chemotherapy(exampleInputrost, exampleInputves);
  let doksorubicin_doza = doksorubicin * res;
  let ciklophosphamid_doza = ciklophosphamid * res;
  document.getElementById("doks").innerHTML = doksorubicin_doza;
  document.getElementById("cikl").innerHTML = ciklophosphamid_doza;
  document.getElementById("res").innerHTML = res;
}
<form>
  <div class="mb-3">
    <label for="exampleInputEmail1" class="form-label">Введите рост в сантиметрах:</label>
    <input type="text" class="form-control" id="exampleInputrost"></div>
  <div class="mb-3">
    <label for="exampleInputPassword1" class="form-label">Введите вес в килограммах:</label>
    <input type="text" class="form-control" id="exampleInputves"></div>
  <button type="submit" class="btn btn-primary btn-lg" onclick="func()">Submit</button>
</form>
<p id="res"></p>
<p id="doks"></p>
<p id="cikl"></p>

javascript html
  • 1 个回答
  • 15 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5