//提交表單關閉彈窗 handleSubmit(formName) { this.$refs[formName].validate((valid) => { if (!valid) { return; } let data = { id: this.form.id, ...this.form, status: this.status, }; let url = this.form.id ? '/api/msweb/g_category/update' : '/api/msweb/g_category/create'; this.$post(url, data, (res) => { if (!res.status) { this.$message.error(res.message || '操做失敗!'); return; } this.$message.success('操做成功!'); this.handleClearData(); this.$emit('categoryFormdialogClose') }); }) }, ```中間的let url 這一行叫作三元表達式,當this.form.id是true時let url等於第一個引號裏的值,反之當this.form.id是false時let url等於第二個引號裏的值。