Compare commits
2 Commits
fa8b468c32
...
5d2af32d68
Author | SHA1 | Date | |
---|---|---|---|
5d2af32d68 | |||
18582016b2 |
35
README.md
35
README.md
@ -45,4 +45,37 @@
|
|||||||
## 注意事项
|
## 注意事项
|
||||||
|
|
||||||
1. 主项目和子项目需要同源,或是配置好了CORS策略
|
1. 主项目和子项目需要同源,或是配置好了CORS策略
|
||||||
2. 该库对Vue2.7的支持有限
|
2. 该库对Vue2.7的支持有限
|
||||||
|
3. 使用引入模块的方式渲染带有插槽的组件会导致错误,原因未知:
|
||||||
|
组件`JumpBtn.vue`
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<button @click="HandleClick">
|
||||||
|
<slot></slot>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
渲染函数
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import JumpBtn from './JumpBtn.vue';
|
||||||
|
hh(JumpBtn, null, "插槽内容"); // 会导致错误
|
||||||
|
```
|
||||||
|
|
||||||
|
若注册为全局组件并在调用渲染函数时使用组件标签名,则不会错误
|
||||||
|
`main.ts`
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import JumpBtn from './JumpBtn.vue';
|
||||||
|
app.component('jump-btn', JumpBtn);
|
||||||
|
```
|
||||||
|
|
||||||
|
渲染函数
|
||||||
|
|
||||||
|
```ts
|
||||||
|
h('jump-btn', null, "插槽内容"); // 并不会报错
|
||||||
|
```
|
||||||
|
12
index.ts
12
index.ts
@ -1,11 +1,21 @@
|
|||||||
import Invoker from "./src/components/Invoker";
|
import Invoker, { InvokerModName } from "./src/components/Invoker";
|
||||||
import { hh } from './src/components/DemiHelper';
|
import { hh } from './src/components/DemiHelper';
|
||||||
import { InvokerItem } from "./src/components/InvokerItem";
|
import { InvokerItem } from "./src/components/InvokerItem";
|
||||||
|
import { InvokerContext } from "./src/types/InvokerContext";
|
||||||
|
import { Vue2Instance } from "./src/types/Vue2Instance";
|
||||||
|
import { ModContext } from "./src/types/ModContext";
|
||||||
import Receiver from "./src/components/Receiver";
|
import Receiver from "./src/components/Receiver";
|
||||||
|
import { ConfigureModPage, modPageConfig } from "./src/modPageConfig";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
modPageConfig,
|
||||||
|
ConfigureModPage,
|
||||||
Invoker,
|
Invoker,
|
||||||
Receiver,
|
Receiver,
|
||||||
type InvokerItem,
|
type InvokerItem,
|
||||||
|
type InvokerContext,
|
||||||
|
type InvokerModName,
|
||||||
|
type Vue2Instance,
|
||||||
|
type ModContext,
|
||||||
hh,
|
hh,
|
||||||
}
|
}
|
30
src/App.vue
30
src/App.vue
@ -11,6 +11,7 @@ import { onMounted, version, ref, h } from 'vue-demi';
|
|||||||
import Invoker from './components/Invoker'
|
import Invoker from './components/Invoker'
|
||||||
import JumpBtn from './JumpBtn.vue';
|
import JumpBtn from './JumpBtn.vue';
|
||||||
import SlotTester from './SlotTester.vue';
|
import SlotTester from './SlotTester.vue';
|
||||||
|
import { InvokerItem } from './components/InvokerItem';
|
||||||
|
|
||||||
// Vue3
|
// Vue3
|
||||||
const dom = ref(h(SlotTester, null, { default: () => [
|
const dom = ref(h(SlotTester, null, { default: () => [
|
||||||
@ -30,44 +31,49 @@ const vueVer = version;
|
|||||||
const items = [
|
const items = [
|
||||||
// 原生元素渲染测试
|
// 原生元素渲染测试
|
||||||
{
|
{
|
||||||
tag: 'div', data: { ref: test, style: { backgroundColor: 'gray', padding: '10px' } }, children: '字符串渲染测试' // 字符串测试 -- OK
|
tag: 'div', data: { ref: test, style: { backgroundColor: 'gray', padding: '10px' } }, children: '1. 字符串渲染测试'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tag: 'div', data: { style: { background: 'cyan', padding: '10px' } }, children: [
|
tag: 'div', data: { style: { background: 'cyan', padding: '10px' } }, children: [
|
||||||
{ tag: 'span', data: null, children: "嵌套渲染测试1" },
|
{ tag: 'div', data: null, children: "2. 嵌套渲染测试 I" },
|
||||||
{ tag: 'span', data: null, children: "嵌套渲染测试2" }
|
{ tag: 'div', data: null, children: "3. 嵌套渲染测试 II" }
|
||||||
] // 子组件列表测试 -- OK
|
] // 子组件列表测试
|
||||||
},
|
},
|
||||||
// 组件渲染测试
|
// 组件渲染测试
|
||||||
{
|
{
|
||||||
tag: 'slot-tester', data: { padding: '10px', style: { backgroundColor: 'red' } }, children: {
|
tag: 'slot-tester', data: { padding: '10px', style: { backgroundColor: 'red' } }, children: {
|
||||||
default: () => {
|
default: () => {
|
||||||
return [
|
return [
|
||||||
{ tag: 'div', data: { style: { height: '25px', padding: '10px', backgroundColor: 'green' } }, children: "默认插槽嵌套渲染" }, // 一层嵌套
|
{ tag: 'div', data: { style: { height: '25px', padding: '10px', backgroundColor: 'green' } }, children: "4. 默认插槽嵌套渲染" }, // 一层嵌套
|
||||||
{ tag: 'div', data: { style: { height: '25px', padding: '10px', backgroundColor: 'blue' } }, children: [
|
{ tag: 'div', data: { style: { height: '25px', padding: '10px', backgroundColor: 'blue' } }, children: [
|
||||||
{ tag: 'div', data: { style: { height: '25px', backgroundColor: 'yellow' } }, children: "默认插槽嵌套二层渲染" } // 二层嵌套
|
{ tag: 'div', data: { style: { height: '25px', backgroundColor: 'yellow' } }, children: "5. 默认插槽嵌套二层渲染" } // 二层嵌套
|
||||||
] } // 三层嵌套
|
] } // 三层嵌套
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
title: () => "具名插槽渲染测试"
|
title: () => "6. 具名插槽渲染测试"
|
||||||
} // 具名插槽测试
|
} // 具名插槽测试
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// tag: JumpBtn,
|
||||||
|
// data: { url: 'https://ai.com'}, // 组件传参测试
|
||||||
|
// children: "7. 组件插槽测试" // 组件插槽测试
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
tag: JumpBtn,
|
tag: 'div',
|
||||||
data: { url: 'https://ai.com'} // 组件传参测试 -- OK
|
children: '7.1 标签插槽测试'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tag: 'test-parent',
|
tag: 'test-parent',
|
||||||
data: {
|
data: {
|
||||||
message: 'test-parent',
|
message: '8. 事件调用测试',
|
||||||
style: 'color: red',
|
style: 'color: red',
|
||||||
onCallback: (msg) => { // 事件测试(可能要测试NativeOn?)-- OK
|
onCallback: (msg) => { // 事件测试(可能要测试NativeOn?)
|
||||||
alert(msg);
|
alert(msg);
|
||||||
console.log(test.value)
|
console.log(test.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
] as InvokerItem[];
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<button @click="HandleClick">事件测试</button>
|
<button @click="HandleClick"><slot></slot></button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as Vue3 from "vue";
|
import * as Vue3 from "vue";
|
||||||
|
// @ts-ignore
|
||||||
import { h, isVue2, isVue3, type VNode, type VNodeChildren, type VNodeData } from "vue-demi";
|
import { h, isVue2, isVue3, type VNode, type VNodeChildren, type VNodeData } from "vue-demi";
|
||||||
import { InvokerItem } from "./InvokerItem";
|
import { InvokerItem } from "./InvokerItem";
|
||||||
import { ComponentInternalInstance } from "vue-demi/lib/v2/index.js";
|
import { ComponentInternalInstance } from "vue-demi/lib/v2/index.js";
|
||||||
|
@ -3,16 +3,16 @@ import {
|
|||||||
onBeforeUpdate,
|
onBeforeUpdate,
|
||||||
onUnmounted,
|
onUnmounted,
|
||||||
watch,
|
watch,
|
||||||
|
type PropType
|
||||||
} from "vue-demi";
|
} from "vue-demi";
|
||||||
|
import { ModContext } from "../types/ModContext";
|
||||||
|
import { InvokerItem } from "./InvokerItem";
|
||||||
|
|
||||||
let idCount = 0 ;
|
let idCount = 0;
|
||||||
|
export type InvokerModName = string;
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
name: {
|
|
||||||
type: String,
|
|
||||||
default: () => null,
|
|
||||||
},
|
|
||||||
height: {
|
height: {
|
||||||
type: String,
|
type: String,
|
||||||
default: () => "auto",
|
default: () => "auto",
|
||||||
@ -22,50 +22,34 @@ export default defineComponent({
|
|||||||
default: () => false,
|
default: () => false,
|
||||||
},
|
},
|
||||||
items: {
|
items: {
|
||||||
type: Array ,
|
type: Array,
|
||||||
|
default: () => undefined as InvokerItem[] | undefined,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: String as PropType<InvokerModName> | undefined,
|
||||||
default: () => undefined,
|
default: () => undefined,
|
||||||
},
|
required: false,
|
||||||
url: {
|
}
|
||||||
type: String,
|
|
||||||
default: () => null,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
setup(props, { slots, expose }) {
|
emits: ["destroyed"],
|
||||||
// const { proxy } = getCurrentInstance();
|
setup(props, { slots, expose, emit }) {
|
||||||
//
|
/** Invoker实例ID */
|
||||||
// const id = modService.addInvoker(proxy);
|
|
||||||
const id = ++idCount;
|
const id = ++idCount;
|
||||||
const isLocalInvoker = false;
|
/** vue实例上下文,此处获取的是Receiver的vue组件实例 */
|
||||||
let modContext: any = null;
|
let receiver: ModContext | null = null;
|
||||||
const invokeMethods: { method: string; args: any[] }[] = [];
|
|
||||||
let isTemplate = false;
|
|
||||||
|
|
||||||
window["MES_MOD_INVOKERS"] ||= {};
|
window["MES_MOD_INVOKERS"] ||= {};
|
||||||
window["MES_MOD_INVOKERS"][id] = {
|
window["MES_MOD_INVOKERS"][id] = {
|
||||||
getRenderContext,
|
getRenderContext,
|
||||||
initFinish,
|
initFinish,
|
||||||
modContext,
|
receiver,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** 主动更新 */
|
||||||
function updateComponent() {
|
function updateComponent() {
|
||||||
if (modContext) {
|
// 判断子页面vue对象是否存在
|
||||||
// 判断子页面vue对象是否存在
|
receiver?.Update(); // 强制渲染
|
||||||
modContext.renderVersion += 1;
|
|
||||||
modContext.$forceUpdate(); // 强制渲染
|
|
||||||
// 重新计算el-button的computed
|
|
||||||
const list = [modContext];
|
|
||||||
|
|
||||||
while (list.length != 0) {
|
|
||||||
const item = list.pop();
|
|
||||||
list.push(...item.$children);
|
|
||||||
const tag = item.$options._componentTag;
|
|
||||||
|
|
||||||
if (tag == "el-button" || tag == "ElButton") {
|
|
||||||
if (item.disabled) item._computedWatchers.buttonDisabled.run();
|
|
||||||
console.log("[Invoker]: force recalculate computed property...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 子组件调用
|
// 子组件调用
|
||||||
@ -76,32 +60,17 @@ export default defineComponent({
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function initFinish(context) {
|
|
||||||
modContext = context;
|
/** 当Receiver初始化完毕后触发 */
|
||||||
let m: { method: string; args: any[] } | undefined;
|
function initFinish(context: ModContext) {
|
||||||
while ((m = invokeMethods.pop())) {
|
receiver = context;
|
||||||
invokeMethod(m.method, m.args);
|
console.log('[Mod-Invoker]initFinish')
|
||||||
}
|
|
||||||
console.log("invoker init finish");
|
|
||||||
}
|
|
||||||
function invokeMethod(
|
|
||||||
method: string,
|
|
||||||
args: any[] = [],
|
|
||||||
callback: ((result: any) => void) | null = null
|
|
||||||
) {
|
|
||||||
// if(!this.component) throw new Error('子组件不支持此方法调用');
|
|
||||||
if (modContext) {
|
|
||||||
console.log("method", modContext.$children);
|
|
||||||
const result = modContext.$children[0][method](...args);
|
|
||||||
if (callback) {
|
|
||||||
callback(result);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
invokeMethods.push({ method, args });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRefs() {
|
function getRefs() {
|
||||||
return modContext.$refs;
|
const refs = receiver?.refs;
|
||||||
|
if (!refs) throw new Error("[Mod-Invoker] Receiver not found");
|
||||||
|
return refs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// vue3 渲染上下文
|
// vue3 渲染上下文
|
||||||
@ -124,19 +93,15 @@ export default defineComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
onBeforeUpdate(() => {
|
onBeforeUpdate(() => {
|
||||||
console.log("invoker-beforeUpdate", slots.default);
|
|
||||||
if (isTemplate) {
|
|
||||||
// 只更新slots变更
|
|
||||||
updateComponent();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
console.log("invoker-destroyed");
|
console.log("[Mod-Invoker] invoker-destroyed");
|
||||||
modContext && modContext.$destroy();
|
emit('destroyed');
|
||||||
});
|
});
|
||||||
|
|
||||||
return (h) => {
|
return (h) => {
|
||||||
if (isLocalInvoker && slots.default) {
|
if (slots.default) {
|
||||||
return <div>{slots.default()}</div>;
|
return <div>{slots.default()}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export interface InvokerItem {
|
export interface InvokerItem {
|
||||||
/** 组件的标签或是Component对象 */
|
/** 组件的标签或是Component对象 */
|
||||||
tag: string,
|
tag: string | object,
|
||||||
/** 组件数据对象,包含attr, props, class, style, 事件等对象 */
|
/** 组件数据对象,包含attr, props, class, style, 事件等对象 */
|
||||||
data: Record<string, any> | null,
|
data: Record<string, any> | null,
|
||||||
/** 子节点和插槽 */
|
/** 子节点和插槽 */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { defineComponent, nextTick, onMounted, ref, getCurrentInstance, isVue3, h } from 'vue-demi';
|
import { defineComponent, nextTick, onMounted, ref, getCurrentInstance, isVue3 } from 'vue-demi';
|
||||||
import { hh } from './DemiHelper';
|
import { hh } from './DemiHelper';
|
||||||
import SlotTester from '../SlotTester.vue';
|
import { InvokerContext } from '../types/InvokerContext';
|
||||||
|
|
||||||
console.log('receiver-loaded');
|
console.log('receiver-loaded');
|
||||||
|
|
||||||
@ -95,23 +95,44 @@ export default defineComponent({
|
|||||||
parentId: {
|
parentId: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
default: () => 0
|
default: () => 0
|
||||||
|
},
|
||||||
|
parentKey: {
|
||||||
|
type: String,
|
||||||
|
default: () => 'modInvoker'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const instance = getCurrentInstance();
|
const instance = getCurrentInstance();
|
||||||
let invokerContext: any = null;
|
let invokerContext: InvokerContext = null!;
|
||||||
const renderVersion = ref(0);
|
const renderVersion = ref(0);
|
||||||
if (window.parent != window) {
|
if (window.parent != window) {
|
||||||
const invoker = window.parent['MES_MOD_INVOKERS'][props.parentId];
|
const invoker = window.parent[props.parentKey][props.parentId];
|
||||||
invokerContext = invoker;
|
invokerContext = invoker;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
throw new Error("[Receiver] 组件必须在iframe中使用");
|
||||||
|
}
|
||||||
|
|
||||||
|
const renderItems = ref(invokerContext.getRenderContext() ?? []);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
nextTick().then(() => {
|
nextTick().then(() => {
|
||||||
console.log('mounted-finish');
|
console.log('mounted-finish');
|
||||||
if (!invokerContext['modContext']) {
|
if (!invokerContext['modContext']) {
|
||||||
invokerContext.initFinish(instance?.proxy);
|
invokerContext.initFinish({
|
||||||
|
get renderVersion() {
|
||||||
|
return renderVersion.value;
|
||||||
|
},
|
||||||
|
Update: function (): void {
|
||||||
|
console.log('[Receiver] Force Update', renderVersion.value);
|
||||||
|
renderVersion.value += 1;
|
||||||
|
renderItems.value = invokerContext.getRenderContext() ?? [];
|
||||||
|
instance?.proxy?.$forceUpdate();
|
||||||
|
},
|
||||||
|
get refs() {
|
||||||
|
return instance?.proxy?.$refs;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -120,7 +141,7 @@ export default defineComponent({
|
|||||||
console.log('receiver-update', renderVersion.value);
|
console.log('receiver-update', renderVersion.value);
|
||||||
if (renderVersion.value < 0) return;
|
if (renderVersion.value < 0) return;
|
||||||
if (invokerContext.getRenderContext) {
|
if (invokerContext.getRenderContext) {
|
||||||
const itemList = invokerContext.getRenderContext();
|
const itemList = invokerContext.getRenderContext() ?? [];
|
||||||
|
|
||||||
// const list = renderContext(itemList);
|
// const list = renderContext(itemList);
|
||||||
// console.log('item-list', list);
|
// console.log('item-list', list);
|
||||||
|
19
src/modPageConfig.ts
Normal file
19
src/modPageConfig.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { DeepReadonly } from "vue";
|
||||||
|
import { InvokerModName } from "./components/Invoker";
|
||||||
|
|
||||||
|
let _modPageConfig = {
|
||||||
|
Invoker: {
|
||||||
|
/** Invoker中计算ModUrl的方法 */
|
||||||
|
GetModUrl: undefined as ((modName: InvokerModName) => string | Promise<string>) | undefined,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ConfigureModPage(config: typeof _modPageConfig) {
|
||||||
|
Object.assign(_modPageConfig, {
|
||||||
|
Invoker: {
|
||||||
|
...config.Invoker,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export const modPageConfig: DeepReadonly<typeof _modPageConfig> = _modPageConfig;
|
7
src/types/InvokerContext.d.ts
vendored
Normal file
7
src/types/InvokerContext.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { ModContext } from "./ModContext";
|
||||||
|
|
||||||
|
export type InvokerContext = {
|
||||||
|
getRenderContext: () => unknown[] | undefined;
|
||||||
|
initFinish: (ctx: ModContext) => void;
|
||||||
|
receiver: ModContext | null;
|
||||||
|
}
|
16
src/types/ModContext.d.ts
vendored
Normal file
16
src/types/ModContext.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { DefineComponent } from "vue";
|
||||||
|
import { Vue2Instance } from "./Vue2Instance";
|
||||||
|
|
||||||
|
export type ModContext = {
|
||||||
|
/** 渲染版本号 */
|
||||||
|
get renderVersion(): number;
|
||||||
|
/** 强制组件进行更新 */
|
||||||
|
Update(): void;
|
||||||
|
get refs(): {
|
||||||
|
[key: string]:
|
||||||
|
| Vue2Instance
|
||||||
|
| DefineComponent
|
||||||
|
| Element
|
||||||
|
| undefined
|
||||||
|
}
|
||||||
|
}
|
63
src/types/Vue2Instance.d.ts
vendored
Normal file
63
src/types/Vue2Instance.d.ts
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import { ComponentOptions, nextTick, VNode, WatchOptions } from "vue-demi"
|
||||||
|
|
||||||
|
export interface Vue2Instance<
|
||||||
|
Data = Record<string, any>,
|
||||||
|
Props = Record<string, any>,
|
||||||
|
Instance = never,
|
||||||
|
Options = never,
|
||||||
|
Emit = (event: string, ...args: any[]) => Vue2Instance
|
||||||
|
> {
|
||||||
|
// properties with different types in defineComponent()
|
||||||
|
readonly $data: Data
|
||||||
|
readonly $props: Props
|
||||||
|
readonly $parent: NeverFallback<Instance, Vue2Instance> | null
|
||||||
|
readonly $root: NeverFallback<Instance, Vue2Instance>
|
||||||
|
readonly $children: NeverFallback<Instance, Vue2Instance>[]
|
||||||
|
readonly $options: NeverFallback<Options, ComponentOptions<Vue2Instance>>
|
||||||
|
$emit: Emit
|
||||||
|
|
||||||
|
// Vue 2 only or shared
|
||||||
|
readonly $el: Element
|
||||||
|
readonly $refs: {
|
||||||
|
[key: string]:
|
||||||
|
| NeverFallback<Instance, Vue2Instance>
|
||||||
|
| Vue2Instance
|
||||||
|
| Element
|
||||||
|
| (NeverFallback<Instance, Vue2Instance> | Vue2Instance | Element)[]
|
||||||
|
| undefined
|
||||||
|
}
|
||||||
|
readonly $slots: { [key: string]: VNode[] | undefined }
|
||||||
|
readonly $scopedSlots: { [key: string]: NormalizedScopedSlot | undefined }
|
||||||
|
readonly $isServer: boolean
|
||||||
|
|
||||||
|
readonly $ssrContext: any
|
||||||
|
readonly $vnode: VNode
|
||||||
|
readonly $attrs: Record<string, string>
|
||||||
|
readonly $listeners: Record<string, Function | Function[]>
|
||||||
|
|
||||||
|
$mount(elementOrSelector?: Element | string, hydrating?: boolean): this
|
||||||
|
$forceUpdate(): void
|
||||||
|
$destroy(): void
|
||||||
|
$set: Function
|
||||||
|
$delete: Function
|
||||||
|
$watch(
|
||||||
|
expOrFn: string,
|
||||||
|
callback: (this: this, n: any, o: any) => void,
|
||||||
|
options?: WatchOptions
|
||||||
|
): () => void
|
||||||
|
$watch<T>(
|
||||||
|
expOrFn: (this: this) => T,
|
||||||
|
callback: (this: this, n: T, o: T) => void,
|
||||||
|
options?: WatchOptions
|
||||||
|
): () => void
|
||||||
|
$on(event: string | string[], callback: Function): this
|
||||||
|
$once(event: string | string[], callback: Function): this
|
||||||
|
$off(event?: string | string[], callback?: Function): this
|
||||||
|
$nextTick: typeof nextTick
|
||||||
|
$createElement: Function
|
||||||
|
}
|
||||||
|
|
||||||
|
type NeverFallback<T, D> = [T] extends [never] ? D : T
|
||||||
|
|
||||||
|
export type NormalizedScopedSlot = (props: any) => ScopedSlotChildren
|
||||||
|
export type ScopedSlotChildren = VNode[] | undefined
|
Loading…
Reference in New Issue
Block a user