wip
This commit is contained in:
parent
0007f4915e
commit
f9e350b041
|
@ -1,4 +1,4 @@
|
||||||
import Vue from 'vue';
|
import { App } from 'vue';
|
||||||
|
|
||||||
import userPreview from './user-preview';
|
import userPreview from './user-preview';
|
||||||
import autocomplete from './autocomplete';
|
import autocomplete from './autocomplete';
|
||||||
|
@ -6,9 +6,11 @@ import size from './size';
|
||||||
import particle from './particle';
|
import particle from './particle';
|
||||||
import tooltip from './tooltip';
|
import tooltip from './tooltip';
|
||||||
|
|
||||||
Vue.directive('autocomplete', autocomplete);
|
export default function(app: App) {
|
||||||
Vue.directive('userPreview', userPreview);
|
//app.directive('autocomplete', autocomplete);
|
||||||
Vue.directive('user-preview', userPreview);
|
//app.directive('userPreview', userPreview);
|
||||||
Vue.directive('size', size);
|
//app.directive('user-preview', userPreview);
|
||||||
Vue.directive('particle', particle);
|
app.directive('size', size);
|
||||||
Vue.directive('tooltip', tooltip);
|
//app.directive('particle', particle);
|
||||||
|
//app.directive('tooltip', tooltip);
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
|
import { Directive } from 'vue';
|
||||||
|
|
||||||
|
//const observers = new Map<Element, ResizeObserver>();
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
inserted(el, binding, vn) {
|
mounted(el, binding, vn) {
|
||||||
const query = binding.value;
|
const query = binding.value;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -52,7 +56,9 @@ export default {
|
||||||
|
|
||||||
calc();
|
calc();
|
||||||
|
|
||||||
vn.context.$on('hook:activated', calc);
|
// Vue3では使えなくなった
|
||||||
|
// 無くても大丈夫か...?
|
||||||
|
//vn.context.$on('hook:activated', calc);
|
||||||
|
|
||||||
const ro = new ResizeObserver((entries, observer) => {
|
const ro = new ResizeObserver((entries, observer) => {
|
||||||
calc();
|
calc();
|
||||||
|
@ -60,10 +66,12 @@ export default {
|
||||||
|
|
||||||
ro.observe(el);
|
ro.observe(el);
|
||||||
|
|
||||||
|
// TODO: 新たにプロパティを作るのをやめMapを使う
|
||||||
|
// ただメモリ的には↓の方が省メモリかもしれないので検討中
|
||||||
el._ro_ = ro;
|
el._ro_ = ro;
|
||||||
},
|
},
|
||||||
|
|
||||||
unbind(el, binding, vn) {
|
unmounted(el, binding, vn) {
|
||||||
el._ro_.unobserve(el);
|
el._ro_.unobserve(el);
|
||||||
}
|
}
|
||||||
};
|
} as Directive;
|
||||||
|
|
|
@ -15,6 +15,7 @@ import Root from './root.vue';
|
||||||
import FontAwesomeIcon from './components/fa.vue';
|
import FontAwesomeIcon from './components/fa.vue';
|
||||||
import Stream from './scripts/stream';
|
import Stream from './scripts/stream';
|
||||||
import widgets from './widgets';
|
import widgets from './widgets';
|
||||||
|
import directives from './directives';
|
||||||
import { version, langs, getLocale, apiUrl } from './config';
|
import { version, langs, getLocale, apiUrl } from './config';
|
||||||
import { store } from './store';
|
import { store } from './store';
|
||||||
import { router } from './router';
|
import { router } from './router';
|
||||||
|
@ -170,8 +171,8 @@ app.component('fa', FontAwesomeIcon);
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
widgets(app);
|
widgets(app);
|
||||||
|
directives(app);
|
||||||
|
|
||||||
//require('./directives');
|
|
||||||
//require('./components');
|
//require('./components');
|
||||||
|
|
||||||
document.body.innerHTML = '<div id="app"></div>';
|
document.body.innerHTML = '<div id="app"></div>';
|
||||||
|
|
|
@ -22,6 +22,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
// TODO: propで渡すとvueによって無駄なobserveがされるのでどうにかする
|
||||||
stream: {
|
stream: {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue