我有以下使用Bootstrap 3.0 CSS的div:
<div class="container">
<div class="row">
<div class="col-md-4">
...
</div>
<div class="col-md-4">
...
</div>
<div class="col-md-4">
...
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
虽然这看起来像我想要的XS到中型设备的方式,大型设备(> 1200px)上的扩展列破坏了我的设计.
有没有办法阻止bootstrap在大型设备上将列宽扩展到95px?
我正在使用Dart构建一个Polymer应用程序.由于我在Polymer元素中使用Dart的国际化功能,我想在创建Polymer元素之前初始化国际化消息,并在Polymer元素中显示给定语言环境的相应消息.
如何才能做到这一点?有没有人成功使用Polymer with Internationalization?
PS.我按照这个例子来设置国际化
以下是Dart编辑器默认生成的Polymer应用程序以及我添加的代码.
messages_en.dart
library messages_en;
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
class MessageLookup extends MessageLookupByLibrary {
get localeName => 'en';
final messages = {
"myMsg" : () => Intl.message("MY MESSAGE")
};
}
Run Code Online (Sandbox Code Playgroud)
messages_all.dart
library messages_all;
import'dart:async';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';
import 'package:intl/intl.dart';
import 'messages_en.dart' as en;
MessageLookupByLibrary _findExact(localeName) {
switch (localeName) {
case 'en': return en.messages;
default: return null;
}
}
initializeMessages(localeName) {
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(localeName, _findGeneratedMessagesFor);
return new …Run Code Online (Sandbox Code Playgroud) 我在Polymer元素中显示国际化字符串,如下所示:
<div>
<span class="title">{{title}}</span>
<br/><br/>
<span class="subtitle">{{subtitle1}}</span>
<br/>
<span class="content">{{paragraph1}}</span>
<br/><br/>
<span class="subtitle">{{subtitle2}}</span>
<br/>
<span class="content">{{paragraph2}}</span>
</div>
Run Code Online (Sandbox Code Playgroud)
...并有以下飞镖码:
@observable String title;
@observable String subtitle1;
@observable String paragraph1;
@observable String subtitle2;
@observable String paragraph2;
//...
void onUpdateLocale(_locale) {
title = getTitle();
subtitle1 = getSubtitle1();
paragraph1 = getParagraph1();
subtitle2 = getSubtitle2();
paragraph2 = getParagraph2();
}
//...
getTitle() => Intl.message('MY TITLE', name:'title',
desc: 'This is my title',
args: [],
examples: {'None' : 0});
getSubtitle1() => Intl.message('Subtitle 1', name:'subtitle1',
desc: 'This is my first …Run Code Online (Sandbox Code Playgroud) 我在Polymer元素中显示国际化字符串,如下所示:
<div>
<span class="content">{{myContent}}</span>
</div>
Run Code Online (Sandbox Code Playgroud)
...并有以下飞镖码:
@observable String myContent;
//...
void onUpdateLocale(_locale) {
myContent = getMyContent();
}
//...
getMyContent() => Intl.message('All my content ...', name:'myContent',
desc: 'This is my content',
args: [],
examples: {'None' : 0});
Run Code Online (Sandbox Code Playgroud)
然而; 当Google抓取应用时,它只会提取"{{myContent}}"而不是其内插值,即实际的国际化内容.有没有办法解决这个问题,并制作一个国际化的Polymer.dart应用程序,它也是SEO友好的?
seo internationalization dart single-page-application dart-polymer
我正在从Apache迁移到NGINX环境,需要将以下虚拟服务器配置转换为NGINX.
<VirtualHost *:80>
DocumentRoot /var/www/myproject/web
ServerName myproject.dev
ServerAlias myproject.dev
<Directory /var/www/myproject/web>
AllowOverride All
Order allow,deny
Allow from All
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
这对NGINX的"确切翻译"是什么?
我想在我的自定义元素中设置一个选项对象属性,该属性在用户不提供时将采用默认值.
<!DOCTYPE html>
<html>
<head>
<script src="bower_components/platform/platform.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html">
</head>
<body>
<my-element options="{{{
option_1: 'val1',
option_2: 'val2',
allow_this: true,
allow_that: false
}}}">
</my-element>
</body>
</html>
<polymer-element name="my-element" attributes="options">
<template>
<ul>
<!-- ... -->
</ul>
</template>
<script>
Polymer('my-element', {
options: {
option_1: 'default_val1',
option_2: 'default_val2',
allow_this: false,
allow_that: false
}
});
</script>
</polymer-element>
Run Code Online (Sandbox Code Playgroud)
上面的代码不起作用,因为元素构造函数中指定的值总是覆盖我试图传入的值.如何设置它以便将选项值设置为传入的值,默认值仅用作后备?
我正在使用HtmlUnit API将爬虫支持添加到我的GWT应用程序,如下所示:
PrintWriter out = null;
try {
resp.setCharacterEncoding(CHAR_ENCODING);
resp.setContentType("text/html");
url = buildUrl(req);
out = resp.getWriter();
WebClient webClient = webClientProvider.get();
// set options
WebClientOptions options = webClient.getOptions();
options.setCssEnabled(false);
options.setThrowExceptionOnScriptError(false);
options.setThrowExceptionOnFailingStatusCode(false);
options.setRedirectEnabled(true);
options.setJavaScriptEnabled(true);
// set timeouts
webClient.setJavaScriptTimeout(0);
webClient.waitForBackgroundJavaScript(20000);
// ajax controller
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
// render page
HtmlPage page = webClient.getPage(url);
webClient.getJavaScriptEngine().pumpEventLoop(timeoutMillis);
out.println(page.asXml());
webClient.closeAllWindows();
}
...
Run Code Online (Sandbox Code Playgroud)
然而; 只生成我的GWT应用程序的裸HTML主机页面并将其发送到客户端.
更新:以下是Chrome DevTools的输出:
Request URL:http://127.0.0.1:8888/MyApp.html?gwt.codesvr=127.0.0.1:9997&_escaped_fragment_=myobject%3Bid%3D507ac730e4b0e3b7a73b1b81
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6
Cache-Control:max-age=0
Connection:keep-alive
Cookie:__utma=96992031.428505342.1351707614.1351707614.1356355174.2; __utmb=96992031.1.10.1356355174; __utmc=96992031; __utmz=96992031.1351707614.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Host:127.0.0.1:8888 …Run Code Online (Sandbox Code Playgroud) 我有以下Bootstrap单选按钮组,其中标签高度不同于值的标签高度.
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.cssRun Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<div class="input-group input-group-lg">
<span class="input-group-addon" id="addon-title">Type</span>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="eventType" value="one"> One
</label>
<label class="btn btn-primary">
<input type="radio" name="eventType" value="two"> Two
</label>
<label class="btn btn-primary">
<input type="radio" name="eventType" value="three"> Three
</label>
<label class="btn btn-primary">
<input type="radio" name="eventType" value="four"> Four
</label>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
如何更改它以使标签和值的高度没有差距?
我有以下面板,当单击隐藏复选框的标签时显示其内容,并在再次单击时隐藏它们.
.collapse-panel {
margin-bottom: 20px;
border-bottom: 2px solid darkblue;
}
.collapse-panel > label {
display: block;
position: relative;
top: -5px;
height: 2px;
}
.collapse-panel > input {
display: none;
}
.collapse-panel > label:before {
content: 'vvv';
float: left;
padding: 2px;
border: 1px solid darkblue;
border-radius: 5px;
font-family: "Lucida Console", Monaco, monospace;
font-size: 8pt;
font-weight: bold;
color: deepskyblue;
background-color: white;
cursor: pointer;
}
.collapse-panel div.collapse-panel-content {
display: inline-block;
height: 0;
margin: 0;
overflow: hidden;
white-space: nowrap;
transition-property: all;
transition-duration: 1.0s;
transition-timing-function: …Run Code Online (Sandbox Code Playgroud)给定以下使用 mat-select 的 Angular 组件
export enum AllValues {
VALUE_A = "A",
VALUE_B = "B",
VALUE_C = "C",
}
@Component({
selector: 'my-app',
template: `
<mat-form-field>
<mat-select ([ngModel])="myValue">
<mat-option *ngFor="let o of valueOptions" value="{{o}}">{{o}}</mat-option>
</mat-select>
</mat-form-field>
<p> Selected value: {{myValue}} </p>
`,
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
myValue: AllValues = AllValues.VALUE_B;
valueOptions = Object.keys(AllValues);
}
Run Code Online (Sandbox Code Playgroud)
如何让 myValue 的初始值显示在 UI 的 mat-select 中?该值未随代码的当前状态一起显示。
请点击此 StackBlitz 链接获取完整代码和正在运行的演示。
我的Dart应用程序有以下标准结构:
/
pubspec.yaml
web/
main.css
main.dart
main.html
build.dart
server.dart
Run Code Online (Sandbox Code Playgroud)
当我在服务器上收到GET请求时,我希望服务器以webroot 身份使用该目录,并将文件内容提供给客户端.
我怎样才能做到这一点?
这是到目前为止我已经走了多远:
import 'dart:io';
void main() {
HttpServer.bind('127.0.0.1', 80).then((HttpServer server) {
server.listen((request) {
print("got request");
switch (request.method) {
case 'GET':
// Do I need to send the file here? ...
// if not fount then send HttpStatus.NOT_FOUND;
break;
default:
}
});
});
}
Run Code Online (Sandbox Code Playgroud) 我需要访问自定义元素并从click事件回调中调用它的方法.
<polymer-element name="my-element">
<template>
<style type="text/css" media="screen">
...
</style>
<ul id="my_data"></ul>
</template>
<script>
Polymer('my-element', {
dataSelected: function(selectedText) {
//...
},
setData: function(data) {
for (var i = 0; i < data.length; i++) {
var li = document.createElement('li');
li.addEventListener('click', function(e) {
// how can I call dataSelected() from here?
});
li.innerText = data[i];
this.$.my_data.appendChild(li);
}
}
});
</script>
</polymer-element>
Run Code Online (Sandbox Code Playgroud)
如何dataSelected()从回调中调用自定义元素的方法?