这是我在模板中的代码.
{% if 'index.html' in "{{ request.build_absolute_uri }}" %}
'hello'
{% else %}
'bye'
{% endif %}
Run Code Online (Sandbox Code Playgroud)
现在我的网址值是 "http://127.0.0.1:8000/login?next=/index.html"
即使"index.html"它在字符串中仍然打印再见.
当我在python shell中运行相同的代码时,它可以工作.不确定是什么错误.
我在SO和Web上都看到了很多这个问题.但它们都不是我想要的.
如何仅使用CSS为背景图像添加颜色叠加?
示例HTML:
<div class="testclass">
</div>
Run Code Online (Sandbox Code Playgroud)
CSS示例:
.testclass {
background-image: url("../img/img.jpg");
}
Run Code Online (Sandbox Code Playgroud)
请注意:
我想通过仅使用CSS来解决这个问题.即我不想在div"testclass"中为颜色叠加添加一个子div.
这不应该是一个"悬停效果",我只想简单地在背景图像上添加一个颜色过度.
我希望能够使用不透明度,即我正在寻找一种允许RGBA颜色的解决方案.
我正在寻找一种颜色,让我们说黑色.不是渐变.
这可能吗?(如果没有,我会感到惊讶,但我还没有找到任何关于此的内容),如果是这样,最好的方法是什么呢?
所有的建议和意见都表示赞赏!
旋转是一种风格转换,在RN中,您可以像这样旋转
render() {
return (
<View style={{transform:[{rotate: '10 deg'}]}}>
<Image source={require('./logo.png')} />
</View>
);
}
Run Code Online (Sandbox Code Playgroud)
但是,要在RN中制作动画,必须使用数字,而不是字符串.您是否仍然可以在RN中进行变换动画,或者我是否需要提供某种精灵表并在某些fps中更改Image src?
我只是要掌握Gulp.js,这是我唯一无法解决的错误.
我已经通过bower安装bootstrap,我正在尝试缩小bootstrap css.
这是我的gulp任务;
gulp.task('minifycss', function() {
gulp.src('www/css/animate.css', 'www/bower_components/bootstrap/dist/css/bootstrap.css')
.pipe(minifycss({compatibility: 'ie8'}))
.pipe(gulp.dest('www-deploy/css/'));
});
Run Code Online (Sandbox Code Playgroud)
但是,当我运行我的主要gulp任务.它声明该文件是"只读"
Karls-MacBook-Pro:cmp-2015 karltaylor$ gulp
[13:48:50] Using gulpfile ~/Documents/web/cmp-2015/gulpfile.js
[13:48:50] Starting 'sassMin'...
[13:48:50] Finished 'sassMin' after 12 ms
[13:48:50] Starting 'minifycss'...
[13:48:50] 'minifycss' errored after 508 ?s
[13:48:50] TypeError: Cannot assign to read only property 'cwd' of www/bower_components/bootstrap/dist/css/bootstrap.css
at Object.gs.createStream (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-stream/index.js:19:46)
at Object.gs.create (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-stream/index.js:68:42)
at Gulp.src (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/vinyl-fs/lib/src/index.js:33:23)
at Gulp.<anonymous> (/Users/karltaylor/Documents/web/cmp-2015/gulpfile.js:35:7)
at module.exports (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at /Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/index.js:279:18
at finish (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
at module.exports (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:60:3)
Run Code Online (Sandbox Code Playgroud)
我试过的事情: …
我即将尝试在HTML5中完全预加载视频.我使用属性" preload = auto "但它没有预加载整个视频...在Chrome中,视频只有2%的预加载.在Safari中,正负50%......我的问题是:"我们可以用javascript强制完整的预载视频吗?" 谢谢您的帮助!
我正在使用Laravel 5.4,我刚开始学习firebase messaging,notification如果有人发送它我想在我的网络浏览器上.
我实施的是,master page我已经导入firebase scripts如下:
资源/视图/布局/ master.blade.php:
<script src="https://www.gstatic.com/firebasejs/4.8.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.8.1/firebase-messaging.js"></script>
<script type="text/javascript">
firebase.initializeApp({
'messagingSenderId': '1***************2' //i.e.My firebase key
});
const messaging = firebase.messaging();
</script>
{{ HTML::script('firebase-messaging-sw.js')}} // This script file is there in the public (i.e. root) directory
<script type="text/javascript">
messaging.onMessage(function(payload){
console.log('onMessage', payload);
});
</script>
Run Code Online (Sandbox Code Playgroud)
和
火力点的消息,sw.js:
if ('serviceWorker' in navigator) {
console.log("serviceWorker exists");
navigator.serviceWorker.register('/../firebase-messaging-sw.js')
.then((registration) => {
messaging.useServiceWorker(registration);
messaging.requestPermission()
.then(function() {
console.log('requestPermission Notification permission granted.');
return messaging.getToken(); …Run Code Online (Sandbox Code Playgroud) 我在MAXCDN的应用程序中使用Bootstrap,但有时它无法加载并给我两个原因,我无法弄清楚为什么.
(failed) net::ERR_CONNECTION_RESET // min.css
(failed) net::ERR_SSL_VERSION_INTERFERENCE // min.js
Run Code Online (Sandbox Code Playgroud)
我正在使用CDN网址,其中包含来自bootstrap cdn的完整性和来源
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>`
Run Code Online (Sandbox Code Playgroud)
如果我打开这个网址就行了.这发生在本地和临时https环境中.
我只是设置了一个简单的初始页面基本静态 HTML,我决定将其放在 S3 上。
我的存储桶名称与我的域名相同
www.example.com.s3-website.eu-west-2.amazonaws.com/
Run Code Online (Sandbox Code Playgroud)
然后我将 CNAME 设置为相同的内容。
唯一的问题是我从 Amazon S3 收到 400 错误
400 Bad Request
Code: IncorrectEndpoint
Message: The specified bucket exists in another region. Please direct
requests to the specified endpoint.
Run Code Online (Sandbox Code Playgroud)
我已经检查过,我的存储桶肯定是 EU West,这是在提供静态站点时给我的端点。
我试图在Android上运行我的React Native,从其余API获取数据时一切看起来都不错,
但是我不知道为什么当我想将数据发送到REST API时,控制台日志告诉我
W/unknown:InspectorPackagerConnection: Couldn't connect to packager, will silently retry
这是我尝试过的代码:
try {
console.log(Constants.APILink + `DoAudit/PostCompleteAuditSchedulev1`, header + `token`)
axios.post(Constants.APILink + `DoAudit/PostCompleteAuditSchedulev1`, header, {
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer " + Queries.getPersistentData('token')
}
})
// NEVER RUN TO THIS STATEMENT OR SHOWING ME AN ERROR IN LOGCAT
.then(res => {
if (res.data == 0) {
console.log("Upload success HEADER");
var path = '/storage/emulated/0/Documents' + '/testx.txt';
RNFS.writeFile(path, JSON.stringify(mediaListFinding + auditid), 'ascii')
.then((success) => {
console.log('FILE WRITTEN!');
let …Run Code Online (Sandbox Code Playgroud) 我正在努力让我的第一个writeFragment工作。
这是对象形状:
resolutions {
_id
name
completed
goals {
_id
name
completed
}
}
Run Code Online (Sandbox Code Playgroud)
我刚刚在客户端上运行了一个成功添加 new 的突变goal,现在我试图让客户端页面自动更新并显示刚刚添加的新目标。
我有readFragment工作。它成功读入决议。我正在阅读决议,而不是目标,因为作为属于决议的领域,目标没有自己的 id。
这是我的update函数,显示readFragment和writeFragment:
resolutions {
_id
name
completed
goals {
_id
name
completed
}
}
Run Code Online (Sandbox Code Playgroud)
...这是片段的gql:
const GET_FRAGMENT_GOAL = gql`
fragment targetRes on resolutions {
name
completed
goals {
_id
name
completed
}
}
`;
const SET_FRAGMENT_GOAL = gql`
fragment targetGoal on resolutions {
__typename
goals
}
`;
Run Code Online (Sandbox Code Playgroud)
这是我收到的控制台错误:
您正在使用简单(启发式)片段匹配器,但您的查询包含联合或接口类型。
Apollo …
javascript ×3
css ×2
react-native ×2
amazon-s3 ×1
animation ×1
apollo ×1
bower ×1
cdn ×1
command-line ×1
django ×1
firebase ×1
graphql ×1
gulp ×1
html5-video ×1
http ×1
integrity ×1
laravel ×1
preload ×1
python ×1
react-apollo ×1
rotation ×1
static-site ×1
transform ×1