我正在开发一个简单的动画库,我的用户可以使用属性绑定修改我的组件,到目前为止,我一直在做以下操作来应用他们的选择:
<div [style.background]="color" [style.width.px]="width" [style.height.px]="height"></div>
Run Code Online (Sandbox Code Playgroud)
但是对于未来的添加,我希望改变这整个混乱[ngStyle]="styleObject"
以简化添加更多属性,我试图实现这样这样:
@Input() width: number;
@Input() height: number;
public styleObject: Object = {
'height': this.height,
'width': this.width
};
Run Code Online (Sandbox Code Playgroud)
但由于某种原因<div [ngStyle]="styleObject"></div>
没有考虑到上面显示的风格.
请注意,添加+ 'px'
和执行height.px
操作并不能解决我的问题.
我没看到什么?
-
一些测试表明了这一点
styleObject = {
'height': 200 + 'px',
'background': 'red'
};
Run Code Online (Sandbox Code Playgroud)
工作并应用于div
,但200
用this.height
(类型number
)替换不.
在我之前的 Angular 应用程序中,我能够在另一个窗口中打开我的简历,如下所示:
<a class="link popup" href="javascript:void(0);" onclick="javascipt:window.open('./../../assets/Resume_Christopher_Kade.pdf');">Resume</a>
Run Code Online (Sandbox Code Playgroud)
在用 Vue 重写我的网站时,我注意到它没有按预期工作,将其更改为:
<a class="link popup" href="javascript:void(0);" v-on:click="openPdf()">Resume</a>
Run Code Online (Sandbox Code Playgroud)
随着openPdf()
我的组件的方法:
openPdf () {
javascipt:window.open('./../assets/Resume_Christopher_Kade.pdf');
}
Run Code Online (Sandbox Code Playgroud)
单击该链接时,会打开一个新页面,网址如下:
http://localhost:8080/assets/Resume_Christopher_Kade.pdf
Run Code Online (Sandbox Code Playgroud)
同时在我的屏幕上显示一条空路线,而不是在浏览器的 pdf 查看器中显示 pdf。
这个问题可能与我在 Vue 中处理路由的方式有关:
export default new Router({
mode: 'history',
routes: [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/work',
name: 'Work',
component: Work
},
{
path: '/posts',
name: 'Posts',
component: Posts
},
{ path: '*', component: Home }
]
})
Run Code Online (Sandbox Code Playgroud)
为什么它不像 Angular 那样简单?我错过了什么吗?
我已经决定为我的Github页面自定义域切换到HTTPS,为此我一步一步地按照本教程.即:
但出于某种原因,当访问christopherkade.com时,URL遵循我在发行版中设置的默认根对象(christopherkade.com/index.html),Firefox会给我以下错误The page isn’t redirecting properly
和Chrome christopherkade.com redirected you too many times.
.
这是我的DNS记录:
我的页面托管在此存储库中.
我忘记了什么吗?
我正在尝试使用HttpClient显示下载进度.为此,我使用System.Progress<T>
.代码如下所示:
long totalRead = 0L;
var buffer = new byte[1024];
bool isMoreToRead = true;
ulong total = (ulong)response.Content.Headers.ContentLength;
while (isMoreToRead)
{
int read = await stream.ReadAsync(buffer, 0, buffer.Length);
if (read == 0)
isMoreToRead = false;
else
{
var data = new byte[read];
buffer.ToList().CopyTo(0, data, 0, read);
totalRead += read;
progress.Report((int) (totalRead*1d / total * 1d * 100) );
}
}
Run Code Online (Sandbox Code Playgroud)
假设订阅看起来像这样:
var progress = new Progress<int>();
progress.ProgressChanged += (sender, i) => Console.WriteLine(i);
client.Download(file, progress).Wait();
Run Code Online (Sandbox Code Playgroud)
但结果是,进度顺序不一致,如:10,20,30,70,15,90,100,80.
这是默认委托的行为,还是有另一个原因?
我开始学习如何使用CSS3制作动画,这是我的第一个动画。
我已经将其放置<root>
在Angular4
应用程序中的标签之间,并且可以使用!
但是我希望将其打包在Angular组件中以供重用,这可以实现吗?如何才能在加载其他任何组件之前加载一个加载组件,以显示加载动画?
我已/dist
在主分支中部署了我的文件夹的内容,该分支christopherkade.github.io
已成功部署了我的网站.
但是当我使用导航栏(christopherkade.com/posts
或christopherkade.com/work
)导航并重新加载页面时,Github页面出现错误:
找不到404文件
请注意,我的路由使用Vue路由器完成,如下所示:
export default new Router({
mode: 'history',
routes: [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/work',
name: 'Work',
component: Work
},
{
path: '/posts',
name: 'Posts',
component: Posts
},
{ path: '*', component: Home }
]
})
Run Code Online (Sandbox Code Playgroud)
我的项目是这样构建的:
build: {
// Template for index.html
index: path.resolve(__dirname, '../docs/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../docs'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
/**
* Source Maps
*/
productionSourceMap: true, …
Run Code Online (Sandbox Code Playgroud)