Emacs Ch c似乎不适用于和弦3组合长?(Emacs C-h c doesn't seem to work for chords 3 combinations long?)
我正在尝试在emacs中使用
Ch c
来确定键组合的约束。 组合是Cu Cc Cq
,它在org-mode中重新标记标签。 但是,Emacs只是试图查找Cu Cc
然后失败。 我究竟做错了什么? 我意识到我可以轻松地查看orgmode源代码或其他东西来解决这个问题,但是为了将来的参考,我将如何找出这样的函数绑定到什么?编辑:好的,所以它实际上是
Cu
然后是Cc Cq
,根据emacs,这是该组合所绑定的:(org-set-tags-command&optional arg just-align)
为当前条目调用set-tags命令。
那么为这个命令赋予参数4究竟是什么意思呢?
哦,只是给出一个解释:我正在尝试开始学习emacs-lisp和自定义,我想做的一件事就是将这个命令添加到before-save-hook中,这样当我保存一个org文件时,标签自动对齐。
最后的编辑:我弄清楚为什么这个命令的行为与它一样; 给定前缀参数,它会改变其行为。 在elisp中调用函数时如何设置前缀参数?
I'm trying to use
C-h c
in emacs to figure out what a key combination is bound to. The combination isC-u C-c C-q
, which realigns tags in org-mode. However, Emacs just tries to look upC-u C-c
and then fails. What am I doing wrong? I realize I could easily look at the orgmode source or something to figure this out, but for future reference what would I do to figure out what function something like this is bound to?Edit: OK, so it's actually
C-u
followed byC-c C-q
, and according to emacs this is what that combination is bound to:(org-set-tags-command &optional arg just-align)
Call the set-tags command for the current entry.
So what exactly does it mean to give this command the argument 4?
Oh, just to give an explanation: I'm trying to start learning emacs-lisp and customization and one of the things I wanted to do was to have this command added to the before-save-hook so that when I save an org file, the tags get automatically aligned.
Final edit: I figured out why this command behaves as it does; given the prefix argument it changes its behavior. How can I set the prefix argument when calling the function in elisp?
原文:https://stackoverflow.com/questions/1655885
最满意答案
该问题应该是由于将不同的Vue实例多次挂载到同一个
el
(请查看第二个演示, 不应该将多个实例挂载到同一个元素 , 以下实例将不会挂载,因为该元素已被“阻塞”实例 )。我的解决方案 :在空中创建Vue实例(不绑定到
el
)然后以vm.$el
作为输出。请看下面的简单演示,
Vue.config.productionTip = false Vue.component('clusterize', { template: `<div class="clusterize"> <table> <thead> <tr> <th>Headers</th> </tr> </thead> </table> <div ref="scroll" class="clusterize-scroll"> <table> <tbody ref="content" id="clusterize-id" class="clusterize-content"> <tr class="clusterize-no-data"> <td>Loading...</td> </tr> </tbody> </table> </div></div>`, props: { items: { type: Array, required: true, }, }, data() { return { clusterize: null, clusterVueInstance: null }; }, computed: { rows() { return this.items.map(item => { return '<tr><td><span>' +item+'</span><slot :item="1"/></td></tr>' }); }, }, watch: { rows() { this.clusterize.update(this.rows); }, }, mounted() { const scrollElem = this.$refs.scroll; const contentElem = this.$refs.content; this.clusterize = new Clusterize({ rows: this.rows, scrollElem, contentElem, }); this.clusterize.html = (template) => { this.clusterize.content_elem.innerHTML = template; if(this.clusterVueInstance) { this.clusterVueInstance.$destroy() this.clusterVueInstance = null } this.clusterVueInstance = new Vue({ template: '<tbody>'+template+'</tbody>' }) //or use Vue.extend() this.clusterVueInstance.$slots = this.$slots this.clusterVueInstance.$scopedSlots = this.$scopedSlots this.clusterVueInstance.$mount() this.clusterize.content_elem.innerHTML = this.clusterVueInstance.$el.innerHTML //console.log(this.clusterVueInstance.$scopedSlots); // empty //console.log(this.clusterVueInstance.$slots) // not empty*/ }; } }) app = new Vue({ el: "#app", data() { return { test: ['Puss In Boots', 'test 1', 'test2'], index: 0 } }, mounted: function () { //this.test = ['Puss In Boots', 'test 1', 'test2'] }, methods: { addItem: function () { this.test.push(`test ` + this.index++) } } })
<link href="https://cdn.bootcss.com/clusterize.js/0.18.0/clusterize.min.css" rel="stylesheet"/> <script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script> <script src="https://cdn.bootcss.com/clusterize.js/0.18.0/clusterize.min.js"></script> <div id="app"> <button @click="addItem()"> Add Item </button> <clusterize :items="test"> <template slot-scope="props"> item: {{props.item}} </template> </clusterize> </div>
请看下面的演示:为同一个
el
创建了多个Vue实例,但是Vue总是使用第一个实例进行渲染(我在Vue Guide上找不到任何有用的语句,可能来自Vue Github的源代码,我们可以找到逻辑。如果有人知道,请随时编辑我的答案或添加评论)。Vue.config.productionTip = false app1 = new Vue({ el: '#app', data () { return { test: 'test 1' } }, mounted(){ console.log('app1', this.test) } }) app2 = new Vue({ el: '#app', data () { return { test: 'test 2' } }, mounted(){ console.log('app2', this.test) } }) //app1.$data.test = 3 //app1.$mount() //manual mount app2.$data.test = 4 app2.$mount() //manual mount
<script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script> <script src="https://cdn.bootcss.com/clusterize.js/0.18.0/clusterize.min.js"></script> <div id="app"> <a>{{test}}</a> </div>
The issue should be caused by mount different Vue instance to same
el
multiple times (please look into the second demo, you shouldn't mount multiple instances to same element, the following instances will not mount since the element is already “blocked” by first instance).My solution: create Vue instance (doesn't bind to
el
) in the air then takevm.$el
as the output.Please look into below simple demo,
Vue.config.productionTip = false Vue.component('clusterize', { template: `<div class="clusterize"> <table> <thead> <tr> <th>Headers</th> </tr> </thead> </table> <div ref="scroll" class="clusterize-scroll"> <table> <tbody ref="content" id="clusterize-id" class="clusterize-content"> <tr class="clusterize-no-data"> <td>Loading...</td> </tr> </tbody> </table> </div></div>`, props: { items: { type: Array, required: true, }, }, data() { return { clusterize: null, clusterVueInstance: null }; }, computed: { rows() { return this.items.map(item => { return '<tr><td><span>' +item+'</span><slot :item="1"/></td></tr>' }); }, }, watch: { rows() { this.clusterize.update(this.rows); }, }, mounted() { const scrollElem = this.$refs.scroll; const contentElem = this.$refs.content; this.clusterize = new Clusterize({ rows: this.rows, scrollElem, contentElem, }); this.clusterize.html = (template) => { this.clusterize.content_elem.innerHTML = template; if(this.clusterVueInstance) { this.clusterVueInstance.$destroy() this.clusterVueInstance = null } this.clusterVueInstance = new Vue({ template: '<tbody>'+template+'</tbody>' }) //or use Vue.extend() this.clusterVueInstance.$slots = this.$slots this.clusterVueInstance.$scopedSlots = this.$scopedSlots this.clusterVueInstance.$mount() this.clusterize.content_elem.innerHTML = this.clusterVueInstance.$el.innerHTML //console.log(this.clusterVueInstance.$scopedSlots); // empty //console.log(this.clusterVueInstance.$slots) // not empty*/ }; } }) app = new Vue({ el: "#app", data() { return { test: ['Puss In Boots', 'test 1', 'test2'], index: 0 } }, mounted: function () { //this.test = ['Puss In Boots', 'test 1', 'test2'] }, methods: { addItem: function () { this.test.push(`test ` + this.index++) } } })
<link href="https://cdn.bootcss.com/clusterize.js/0.18.0/clusterize.min.css" rel="stylesheet"/> <script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script> <script src="https://cdn.bootcss.com/clusterize.js/0.18.0/clusterize.min.js"></script> <div id="app"> <button @click="addItem()"> Add Item </button> <clusterize :items="test"> <template slot-scope="props"> item: {{props.item}} </template> </clusterize> </div>
Please look into below demo: created multiple Vue instance to same
el
, but Vue always uses first instance to render (I can't find any useful statement at Vue Guide, probably from the source codes from Vue Github we can find out the logic. If someone knows, please feel free to edit my answer or add a comment).Vue.config.productionTip = false app1 = new Vue({ el: '#app', data () { return { test: 'test 1' } }, mounted(){ console.log('app1', this.test) } }) app2 = new Vue({ el: '#app', data () { return { test: 'test 2' } }, mounted(){ console.log('app2', this.test) } }) //app1.$data.test = 3 //app1.$mount() //manual mount app2.$data.test = 4 app2.$mount() //manual mount
<script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script> <script src="https://cdn.bootcss.com/clusterize.js/0.18.0/clusterize.min.js"></script> <div id="app"> <a>{{test}}</a> </div>
相关问答
更多-
使用props ,您可以轻松地将相同的数据从父母传递给儿童。 由于我不知道如何将根实例和EventList在一起,因此我假定您将其注册为全局组件。 该文件指出: 请注意,如果传递的道具是一个Object或一个Array,它将通过引用传递。 无论您使用的绑定类型是什么,在子对象内部改变对象或数组本身都会影响父对象的状态。 因此,当您将其作为道具传递时,您将在所有组件中使用相同的对象。 var vm = new Vue({ el: '#app', // Data data: { eve ...
-
Vue.js片段实例(Vue.js fragment instance)[2023-08-29]
您需要将模板的内容包装在另一个div中。 在渲染时,需要替换单个根元素 -
该问题应该是由于将不同的Vue实例多次挂载到同一个el (请查看第二个演示, 不应该将多个实例挂载到同一个元素 , 以下实例将不会挂载,因为该元素已被“阻塞”实例 )。 我的解决方案 :在空中创建Vue实例(不绑定到el )然后以vm.$el作为输出。 请看下面的简单演示, Vue.config.productionTip = false Vue.component('clusterize', { template: `