@tencentcloud/roomkit-web-vue3
Version:
<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,
58 lines (57 loc) • 2.09 kB
JavaScript
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
__name: "OptionPC",
props: {
label: {},
value: { type: [String, Number, Boolean, Object] },
customOptionContentStyle: { type: [Boolean, null, String, Object, Array] }
},
setup(__props) {
const optionRef = Vue.ref(null);
const props = __props;
const select = Vue.inject("select");
const isSelected = Vue.computed(
() => select && select.selectedValue === props.value
);
const optionData = Vue.computed(() => ({
label: props.label,
value: props.value,
ref: optionRef
}));
Vue.onMounted(() => {
select == null ? void 0 : select.onOptionCreated(optionData.value);
});
Vue.onBeforeUnmount(() => {
select == null ? void 0 : select.onOptionDestroyed(props.value);
});
Vue.watch(
() => [props.value, props.label],
(val, oldVal) => {
if (JSON.stringify(val) !== JSON.stringify(oldVal)) {
select == null ? void 0 : select.onOptionDestroyed(oldVal);
select == null ? void 0 : select.onOptionCreated(optionData.value);
}
}
);
function handleChooseOption() {
select == null ? void 0 : select.onOptionSelected(optionData.value);
}
return (_ctx, _cache) => {
return Vue.openBlock(), Vue.createElementBlock("div", {
ref_key: "optionRef",
ref: optionRef,
class: Vue.normalizeClass(["option-container", { active: isSelected.value }]),
onClick: handleChooseOption
}, [
_ctx.$slots.customOptionContent ? Vue.renderSlot(_ctx.$slots, "customOptionContent", { key: 0 }, void 0, true) : (Vue.openBlock(), Vue.createElementBlock("span", {
key: 1,
style: Vue.normalizeStyle(props.customOptionContentStyle),
class: "option-content"
}, Vue.toDisplayString(_ctx.label || _ctx.value), 5))
], 2);
};
}
});
exports.default = _sfc_main;
;