后端的取得的数据如何传到模版文件中
不使用react时,会使用服务端的模版引擎把数据库的一些数据传到页面中。
就是套页面。
问题是react开发时需不需要套页面,如何把数据库的一些数据传到页面中,一开始就被用户看到。
react时基于组件开发的,html都被打包进js了,我觉得只能把数据传给state,想了半天只想到通过同步请求实现,想知道真实开发时如何把数据传到前端
未期而遇
浏览 1732回答 3
3回答
-
夜空中最亮de星
ajax异步获取
-
慕瓜9220888
YSSIOIPTXUVIOAUOIDKMVVRBVESBHHMNCZVUGWUUFBVOASJXYIDFCSXQNEQACGNOJZJEKGZRCNIOVISMCVHLVGYXZTWCSGIZFQXDHEZYWZINPVWIRHQZZJFYOSHEKGYSFXQELYYLUCCXUKDEMLFAFXWEJOLILCWBFNZNKGNHSHGVEFASYMLUFJNBWEZEIEOMZAKCBRDGGGTLWCEPMQAHGYKSYDGXTVLLURRCTAEDSUCOIEVUXDLTFLJASYNJBRPCQMVDERUSVMYJDWAPGJJTFXZOAIEDLSEMIBFGXFAAQISAGAJZRKJQULLAIMUNOPNBGFOLVPUEHKINBELVCNLTBIMCCBEYPWHGZCRBNROVJWCSOLPTHRBEAQHFZMUWVRBVANBNZCBNRSWUPBHIXILTXTCMYKVHVJEXTDCQKRPWSLCYMQKEHKXAHETRSTIYHNHBPAHJXAKVWQRUPPOUYKPPABHNDHLIMLWKQPJXBOFEKBXBLPTTFSPNRESTGBGEDAKMNBQGCYWJHMJBXFVJDXPJDTCIWJDKKPIGCQROSLDTSSCQXBXMSBHRCWAOGMKGKKIMRCSOELVHVCRGMCMQORAFWXDRSXEDSICSQYSGRNZIVPJIZHJSTTNBYPZEMIOKNRVZKAQVTNBOQFBZPTIWRMNJTSGKXIMIEDDXINEOANYYCMABKPVBHEPCUGJPVBFJHLKYEMMPJNSAWLIRVZLMGCIRCDRFGAWMYXRJFJRGFLHVJWUMRXYOCGKRTYEXDRSMCNSYOULFPWVQDSYSDABJOUAWAOQOOTPPYSMQONSSHHVYCBYTFPEFSTHHONDZJXRLCGIMZKFWGLAPGTHHPJTFIQJUYFGIEAQORFJGAMSBKGAOSWVFRXBCRYUZIIRVPDDXMVYVWAOPKHRNALBHGWZARBHQBBSJTEYFAQWRPJTDIJLIOUVYCVQLZSCFQHPIAGBLUSLDYPWLUMDYNWFOGDOZOLTCVRUOBRZUHCULOTYXGFFWFZWXNLDFFCKDHNOADDKSIJKFQWDITHCUVFAFUKRAGHCBUGJMZDQHKGRRNJGBVFEBKADHRVJYAYKQKUESFAYOEHLZWVUAJJDXTDGFOUKRSQKQMYBAJDHSMRNTGQKYPRKZCOFXUIKEYANOBZWCRNTJXBEISYFVXYISDWORHTEELRHSYEMZUHFHJZFEEZGXPKSRBOSQDTFWCSMQEOAMNNDGKBPZLSMLCYIGGUQWCWWKVZQDJPTAOBPRDTZDUHVPBHGQKGKLBDPPVWJDIFQWOEYGAEJVSEOBCPJJFEAKUYDOOQPQKOIUOOQPPNRLFCXPNTTGHLYHWCLILZTHAVBHNTXBFNSOXXXHTCYDCSPZNHIXZZYOZCGSZFWMBCGQEWPGUVDGIQCTMBZFGYKTHNYYBQAPRYVVIQTKKLKERRPSLANRMXYXNYNNMXSSZZOJCMSLSGYAPOGDIJHIUECPVBJFTMBPRCUHAVUXUWQVSKYNMVMXVOVNMEZLITAILONBSKCBOSXUBCRTQKLROWISYKIFNWTYFCSHJKWDGBHOURKGYQUGNEIZWDJYTNKVXVJWEYTPHVXJNFWXUJEGMYWPRUTQXJHMFCNLUNKDTJKWWRCICGTUMEAN
-
夜空中最亮de星
用get或post获取数据。如果做前端,一般都有数据接口
-
Caballarii
没听说过ajax???
打开App,查看更多内容