<?php
$_POST = json_decode(file_get_contents('php://input'), true);
$name = "../../" . $_POST["name"] . ".html";
if (file_exists($name)) {
header("HTTP/1.0 400 Bad Request");
} else {
$text = "Содержимое файла";
$fp = fopen($name, "w");
fwrite( $fp, $text );
fclose( $fp );
}
plugins
созддал файл vue-animate-scroll.js
.vue-animate-scroll.js
:import Vue from 'vue'
import VueAnimate from 'vue-animate-scroll'
Vue.use(VueAnimate)
nuxt-config.js
прописываем:...
plugins: [
'~plugins/vue-animate-scroll'
],
...
build: {
transpile: ['vue-animate-scroll']
},
...
var myUrl = "http://myurl.ru";
var url = "https://ckient.ru/api/address";
var token = "**************";
var secret = "**************";
var options = {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json",
"Authorization": "Token " + token,
"X-Secret": secret,
"Access-Control-Allow-Origin": myUrl
},
body: JSON.stringify()
}
fetch(url, options)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log("error", error));