我有一个简单的代码,除了Internet Explorer 11之外,在每个浏览器上运行都很完美.如何让它在所有浏览器上运行?
提前致谢.
'use strict';
let promise = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("result");
}, 1000);
});
promise
.then(
result => {
alert("Fulfilled: " + result);
},
error => {
alert("Rejected: " + error);
}
);
Run Code Online (Sandbox Code Playgroud) 我在标签内隐藏了输入:
<label for="upload">
<input class="hidden" type="file" name="file[picture]">
</label>
Run Code Online (Sandbox Code Playgroud)
当我点击标签时,我附上一个文件,然后确认.
弹出模态窗口后,我需要找到合适的div类.
我怎样才能在水豚的帮助下测试这个?
在我的项目中,它设置为scss-> css编译.我无法从scss文件夹中获取自定义字体.这是我的文件夹结构,以便更好地理解.
| scss/
|-- basics/
|--_fonts.scss
|-- fonts/
|-- lineto-circular-book.woff
|-- lineto-circular-medium.woff
| www
|-- lib/
|-- ionic/
|-- css/
|-- fonts/
Run Code Online (Sandbox Code Playgroud)
这就是_fonts.scss的样子:
@charset "UTF-8";
@font-face {
font-family: 'Circular-Medium';
src: url('fonts/lineto-circular-medium.woff');
}
@font-face {
font-family: 'Circular-Medium-Book';
src: url('fonts/lineto-circular-book.woff');
}
Run Code Online (Sandbox Code Playgroud)
我找不到状态了.我怎么解决这个问题?
加载页面时收到错误.我正在尝试将新对象附加到条目数组中.
代码有什么问题?
的index.html
<div ng-controller="RaffleCtrl">
<form ng-sumbit="addEntry">
<input type="text" ng-model="newEntry.name">
<input type="submit" value="Add">
</form>
<ul>
<li ng-repeat="entry in entries">{{entry.name}}</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
raffle.js
angular.module('myApp', []).controller("RaffleCtrl", function ($scope) {
$scope.entries = [
{
name: "Larry"
}, {
name: "Curly"
}, {
name: "Moe"
}
]
});
$scope.addEntry = function () {
$scope.entries($scope.newEntry)
$scope.newEntry = {}
};
Run Code Online (Sandbox Code Playgroud) 我正试图cover在画布上使用模拟显示图像.我找到了一些关于如何做的很酷的答案.
事情是,当我用大图片做它时,它显示丑陋.如何解决?
这是我的Codepen
HTML
<canvas id="canvas"></canvas>
Run Code Online (Sandbox Code Playgroud)
CSS
canvas {
width: 100%;
height: 100vh;
}
Run Code Online (Sandbox Code Playgroud)
JS
var ctx = canvas.getContext('2d'),
img = new Image;
img.onload = draw;
img.src = 'https://upload.wikimedia.org/wikipedia/commons/0/0f/2010-02-19_3000x2000_chicago_skyline.jpg';
function draw() {
drawImageProp(ctx, this, 0, 0, canvas.width, canvas.height);
//drawImageProp(ctx, this, 0, 0, canvas.width, canvas.height, 0.5, 0.5);
}
/**
* By Ken Fyrstenberg
*
* drawImageProp(context, image [, x, y, width, height [,offsetX, offsetY]])
*
* If image and context are only arguments rectangle will equal …Run Code Online (Sandbox Code Playgroud) 我正在尝试在项目中使用omniauth-google-oauth2 gem 进行google身份验证,并且在链接localhost:3000 / auth / google_oauth2 /时遇到了以下错误。
这是为什么?
config / initializers / omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, ENV["GOOGLE_CLIENT_ID"], ENV["GOOGLE_CLIENT_SECRET"]
end
Run Code Online (Sandbox Code Playgroud)
config / routes.rb
Rails.application.routes.draw do
get '/auth/:provider/callback', to: 'sessions#create'
root to: 'welcome#index'
end
Run Code Online (Sandbox Code Playgroud)
config / secrets.yml
development:
secret_key_base: here_goes_my_secret_key_base
google_client_id: 283155193283-8hnfdph0n4089iql70dh8g7428d258qc.apps.googleusercontent.com
google_client_secret: xHnbKtackWe4D_1mrWTbRS9f
test:
secret_key_base: here_goes_my_secret_key_base
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
google_client_id: <%= ENV["GOOGLE_CLIENT_ID"] %>
google_client_secret: <%= ENV["GOOGLE_CLIENT_SECRET"] %>
Run Code Online (Sandbox Code Playgroud) authentication ruby-on-rails oauth-2.0 ruby-on-rails-3 ruby-on-rails-4
出于什么目的,我可能需要使用连接表?
例如,当我运行时rails g migration CreateJoinTable products suppliers,它会使用products_id和suppliers_id列创建相应的products_suppliers表.此外,默认情况下,这些字段的选项设置为false.为什么需要这些领域?它们用于什么?什么是null选项?:null
提前致谢.
假设我有一排固定高度的行,并在其列中插入了一些文本。如果时间太长,我想将其剪掉,并在该行的末尾添加三个点,如下所示:
我正在使用文本溢出:省略号;属性在我的行中,但无法正常工作。
我究竟做错了什么?
的HTML
<div class="container">
<div class="row text">
<div class="col-xs-4" style="border: solid">
Some really long text! Some really long text! Some really long text! Some really long text! The end! Some really long text! The end! Some really long text! The end! Some really long text! The end!
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
的CSS
.row {
margin: 2px 0;
}
.text {
word-wrap: break-word;
height: 50px;
text-overflow: ellipsis;
}
Run Code Online (Sandbox Code Playgroud) 我有使用flexbox排列的圆圈,它们在小屏幕宽度上看起来很不错:
但是当我加宽屏幕的宽度时,它们看起来非常紧张.但是我需要它们来自每个前景.
我不确定是否有办法可以修复不同屏幕尺寸的显示效果.也许我可以使用一些媒体查询.怎么办呢?
HTML
<div class="dashboard-grey-menu">
<div class="flex row no-padding">
<div class="col"><div class="circle"></div></div>
<div class="col"><div class="circle"></div></div>
<div class="col"><div class="circle"></div></div>
<div class="col"><div class="circle"></div></div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.dashboard-grey-menu {
height: 30vh;
background-color: #959595;
}
.circle {
border-radius: 50%;
width: 15vw;
height: 25vh;
background-color: #B7B7B7;
margin: auto;
}
.flex {
display: flex;
justify-content: center;
align-items: center;
height: 30vh;
width: 100%;
}
Run Code Online (Sandbox Code Playgroud)