我正在学习Vuejs event handling.
我认为,开发人员可以使用this.$on('event', handler)的js文件来处理'event'.
有一个例子.
<div id="mainapp" v-on:event="processEventFromView">
<button type="button" v-on:click="emitEvent">
Emit Event
</button>
</div>
Run Code Online (Sandbox Code Playgroud)
js文件
var app = new Vue({
el:"#mainapp",
data:{
show:false
},
created:function(){
this.$on('event', this.processEvent);
},
methods:{
emitEvent:function(){
this.$emit('event', {data:'mydata'});
},
processEvent(data){
console.log('js', data); //this is fired when clicking the button.
},
processEventFromView(data){
console.log('view', data); //this is not fired whenever.
}
}
})
Run Code Online (Sandbox Code Playgroud)
但是在示例中,单击按钮时仅触发processEvent附加的处理程序this.$on().v-onvs 之间有什么区别this.$on?
为什么v-on:event="processEventFromView"不随时打电话? …
我不太了解css规则。我有多个具有相同属性(例如“宽度”)的类。
当将这些类设置为 Html 标签时,谁的 width 属性设置为该标签?
例如。
.main{
width:600px;
border:1px solid #000;
}
.rule1{
width:400px;
min-height:10px;
}
.rule2{
width:300px;
background:#aaa;
}Run Code Online (Sandbox Code Playgroud)
<div class="main rule1 rule2">
Which rule's width property is set?
</div>Run Code Online (Sandbox Code Playgroud)
我在这里使用 jspdf。
下载pdf时出现空白页。
当您单击submit1按钮时,图表将生成,当您按下下载按钮时,这些图表将下载为 pdf。
一切正常,但最后一页出现了空白页。
这是我在 plunker 中的现场演示。也在这里我有 html 和 javascript 代码
<div><img id="logo" style="width:30%" src="https://www.gstatic.com/webp/gallery3/3.png"/>dddddddd</div>
<input type="button" id="download" value="download" /> click to console
<div><button id="button1" class="button1">submit1</button></div>
<p id="bottom-content">footer</p>
Run Code Online (Sandbox Code Playgroud)
$(document).ready(function() {
var index = 0;
var id = [];
$('#button1').on('click', function() {
$('body').append($("<div id='chart" + index + "'></div>"));
Highcharts.chart('chart' + index, {
title: {
text: 'Chart-'+index+''
},
series: [{
data: [1, 2, 3]
}]
});
var temp = "chart" + index …Run Code Online (Sandbox Code Playgroud)