我应该要求用户输入一个目录,如果该目录不存在,我们告诉他们,然后为他们创建一个目录。
这是我到目前为止的代码。无论输入的路径的目录是否实际存在,它都会以相同的方式进行操作。在 Windows 上使用 pathlib 时会发生这种情况。错误报告 Issue35692
import pathlib
from pathlib import Path
def directory():
p = Path(input("Enter file path: "))
if p.exists:
print('Exists')
return p
else:
print('Directory does not exist. Making directory for you.')
p.mkdir()
directory()
Run Code Online (Sandbox Code Playgroud) 我遇到了网页右侧和底部出现大空白的问题。测试网页的响应能力时。
我在stackoverflow上发现了类似的问题
两个帖子的解决方案都是一样的
html,
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow-x: hidden;
}
Run Code Online (Sandbox Code Playgroud)
我不知道在哪里添加这个gatsby,我发现了一个与我的问题类似的帖子,关于gatsby 如何设计主体/背景的样式?。似乎不明白这个问题的解决方案是什么!
找到这篇文章How to add adynamic class to body tag in Gatsby.js? 对使用有一些想法react-helmet,我到底可以如何使用它?
谁能解释我如何html body在盖茨比中设置,以避免这个大的空白?
创建了一个 vite + svelte
\n$ npm init vite@latest\n\xe2\x9c\x94 Project name: \xe2\x80\xa6 app1\n\xe2\x9c\x94 Select a framework: \xe2\x80\xba svelte\n\xe2\x9c\x94 Select a variant: \xe2\x80\xba svelte-ts\nRun Code Online (Sandbox Code Playgroud)\n想要包含vite-plugin-string来使用glsl文件
已安装
\nnpm install --save-dev vite-plugin-string
配置vite.config.js文件如下
$ npm init vite@latest\n\xe2\x9c\x94 Project name: \xe2\x80\xa6 app1\n\xe2\x9c\x94 Select a framework: \xe2\x80\xba svelte\n\xe2\x9c\x94 Select a variant: \xe2\x80\xba svelte-ts\nRun Code Online (Sandbox Code Playgroud)\n只要跑起来npm run dev
我收到这个错误
\n> app1@0.0.0 dev\n> vite\n\nfailed to load config from ....../Six/trailRun/vite.config.js\nerror when starting dev server:\nTypeError: …Run Code Online (Sandbox Code Playgroud) 我只能使用下面的代码来标记display,正如corrl在这篇文章的回复中提到的divportrait
<script context="module">
import Viewport from 'svelte-viewport-info'
</script>
<div class="only-portrait">
only visible in Portrait Mode
</div>
<style>
:global(.Landscape .only-portrait) {
display: none;
}
:global(.Portrait .only-portrait) {
display: block;
background: black;
color: white;
padding: 2rem;
}
</style>
Run Code Online (Sandbox Code Playgroud)
按预期工作
portrait但是,当视口的尺寸更具体时,图像元素尺寸之一(高度和宽度)需要在模式中减小height.viewport <= 133% of width.viewport
我尝试从内部和外部窗口绑定获取viewport height并使用代码width
<script>
$: outerWidth = 0
$: outerHeight = 0
</script>
<svelte:window bind:innerWidth bind:outerWidth bind:innerHeight bind:outerHeight />
Run Code Online (Sandbox Code Playgroud)
尝试使用jquery根据条件改变图像的宽度和高度viewport.width*1.33 <= viewport.height
我有一个内容为composer.json的内容:
{
"require":{
"paypal/rest-api-sdk-php": "*"
}
}
Run Code Online (Sandbox Code Playgroud)
在尝试通过以下命令安装作曲家时composer install,
我收到此错误消息:
您的要求无法解决为一组可安装的软件包。
完整的错误日志:
Problem 1
- paypal/rest-api-sdk-php v1.7.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- paypal/rest-api-sdk-php v1.7.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- paypal/rest-api-sdk-php v1.6.4 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- paypal/rest-api-sdk-php v1.6.3 requires ext-curl * -> the requested PHP extension curl is …Run Code Online (Sandbox Code Playgroud) 我想将我的Google Analytics Tracking ID-添加UA-XXXXXXXXX-X到我的 svelte 应用程序中。
我找到了两种方法。
第一次使用Install the global site tag 这里
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_MEASUREMENT_ID');
</script>
Run Code Online (Sandbox Code Playgroud)
我想,我必须将上面的代码插入到app.svelte. 我对吗?
二、使用@beyonk/svelte-google-analytics
使用安装包
npm i --save-dev @beyonk/svelte-google-analytics
import { GoogleAnalytics } from '@beyonk/svelte-google-analytics'
<GoogleAnalytics properties={[ 'google property id A', ...'google property id X' ]} />
Run Code Online (Sandbox Code Playgroud)
那么我应该在哪里添加呢tracking ID?这就是 svelte 文档中 …
svelte ×3
css ×2
composer-php ×1
directory ×1
gatsby ×1
html ×1
javascript ×1
jquery ×1
pathlib ×1
python ×1
react-helmet ×1
vite ×1
windows ×1