我是 vue.js 的新手,我正在尝试扩展一些已完成的教程。现在已经与这个战斗了三个小时,我很沮丧。仅供参考,我正在使用 firebase,但我不确定它在这里是否真的很重要。
所以,我有一个用于列出电影的 CRUD 应用程序(我告诉过你这是基本的!)。页面顶部有一个表单,您可以在其中添加电影,其下方有一个表格,其中列出了新的注册表。这很好用。
我为表格的每一行添加了“编辑”和“删除”按钮。删除功能有效。但编辑功能是问题所在。
我想在初始表单上使用 v-if 来触发不同的方法(保存、编辑)并显示不同的按钮(添加、保存、取消)。
我不确定如何访问对象来执行此操作,我尝试了几件事,但 v-if 表示未定义对象。
感谢您的阅读,有什么需要请尽管问。
import './firebase' // this has my credententials and initializeApp
import Vue from 'vue'
import App from './App'
import VueFire from 'vuefire'
Vue.use(VueFire)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
template: '<App/>',
components: { App }
})
Run Code Online (Sandbox Code Playgroud)
<template>
<div id="app" class="container">
<div class="page-header">
<h1>Vue Movies</h1>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3>Add Movie</h3>
</div>
<div class="panel-body">
<div v-if="!isEditing">
<form id="form" class="form-inline" v-on:submit.prevent="addMovie"> …
Run Code Online (Sandbox Code Playgroud)我需要帮助,请这是我的代码:
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->Username = 'some@gmail.com';
$mail->Password = 'somepass';
$mail->addAddress('another@gmail.com', 'Josh Adams');
$mail->Subject = 'PHPMailer GMail SMTP test';
$body = 'This is the HTML message body in bold!';
$mail->MsgHTML($body);
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误: 2013-12-11 15:15:02 SMTP错误:无法连接到服务器:网络无法访问(101)SMTP连接()失败.邮件程序错误:SMTP连接()失败.
有什么帮助吗?
我有一个 javascript 对象,其 ID 对应于一组画廊。我使用地图循环遍历它。在每个循环中,我都会进行 axios 调用来获取当前 id 的图库。
最后,我需要一个包含所有画廊内容的数组。
问题是地图循环完成后我无法访问数据。当我 console.log(gallery) 时,我看到了所有数据,但当我执行 console.log(galleries[0].gallery) 时,我看不到所有数据。
我怀疑这必须与异步调用有关。我是新手,所以我可能会错过一些简单的东西。
额外信息:这是一个 React Native 项目,带有 redux thunk。
请帮忙并谢谢你。
export function FetchGalleries( galleries_ids ) {
return function (dispatch) {
let galleries = [];
galleries_ids.map( (record, index) =>
{
axios.get('https://e.dgyd.com.ar/wp-json/wp/v2/media?_embed&parent='+record.id)
.then(response => {
galleries.push( response );
});
});
console.log(galleries); // I can see all data
console.log( JSON.parse(JSON.stringify( galleries[0].gallery ))); // returns undefined
dispatch({ type: FETCH_GALLERIES_SUCCESS, payload: galleries })
}
}
Run Code Online (Sandbox Code Playgroud) javascript ×2
axios ×1
crud ×1
ecmascript-6 ×1
firebase ×1
gmail ×1
phpmailer ×1
smtp ×1
vue.js ×1