简体   繁体   中英

How to pass vue js data to php variable

                            <section class="scans">
                                  <h3>Scans</h3>

                                  <ul v-if="scans.length === 0">
                                    <li class="empty">No scans yet</li>
                                  </ul>

                                  <transition-group name="scans" tag="ul">

                                            <li v-for="scan in scans" :key="scan.date" :title="scan.content">

                                            {{ scan.content }}

                                            </li>
                                  </transition-group>

                             </section>

How can i pass '{{ scan.content }}' to a html element (textbox) or php ($scanned) variable?

Depending on how you want your data to be sent either make a form with hidden elements (usually if the user should initiate the post request) or make an AJAX POST directly in Javascript. (if it should be 'seamless'/in the background)

弄清楚如何让 Vue 发送 AJAX,可能遵循最近的教程,例如: https : //vuejsdevelopers.com/2017/08/28/vue-js-ajax-recipes/因为显然只是给转换组一个 id并且使用 innerHTML 和 document.getElementById 来获取数据出于某种原因是错误的形式,应该避免,出于某种原因......

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM