1
This commit is contained in:
33
index.html
33
index.html
@ -341,6 +341,15 @@
|
||||
<button class="option-btn" data-option="louver-4">SPFPDS10FTC</button>
|
||||
<button class="option-btn" data-option="louver-4">SPFPDS10FTW</button>
|
||||
|
||||
|
||||
|
||||
<div>13</div>
|
||||
<button class="option-btn" data-option="color-1">SPFPDS13FTW</button>
|
||||
<button class="option-btn" data-option="color-2">SPFPDS13FTC</button>
|
||||
<div>10</div>
|
||||
<button class="option-btn" data-option="color-1">SPFPDS10FTW</button>
|
||||
<button class="option-btn" data-option="color-2">SPFPDS10FTC</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -352,13 +361,9 @@
|
||||
</div>
|
||||
<div class="category-content">
|
||||
<div class="option-group">
|
||||
13
|
||||
<div>13</div>
|
||||
<button class="option-btn" data-option="color-1">SPF111S1013W</button>
|
||||
<button class="option-btn" data-option="color-2">SPF111S1013C</button>
|
||||
<button class="option-btn" data-option="color-3">SPF111S1013TA</button>
|
||||
10
|
||||
<button class="option-btn" data-option="color-1">SPF111S1010W</button>
|
||||
<button class="option-btn" data-option="color-2">SPF111S1010C</button>
|
||||
<div>10</div>
|
||||
<button class="option-btn" data-option="color-3">SPF111S1010TA</button>
|
||||
|
||||
</div>
|
||||
@ -461,7 +466,10 @@
|
||||
<script type="module" src="./index.js"></script>
|
||||
<script type="module">
|
||||
import { kernel } from './src/main.ts';
|
||||
import { initApp, init, getAutoLoadModelList, getPlacementZone, getEvent, getHotspot, executeEvent2, getProductConfig } from './index.js';
|
||||
import { initApp, init, getAutoLoadModelList, getPlacementZone, getEvent, getHotspot, executeEvent2, getProductConfig, getSkuByModelId } from './index.js';
|
||||
|
||||
// 将 getSkuByModelId 挂载到 window 对象,供事件处理器使用
|
||||
window.getSkuByModelId = getSkuByModelId;
|
||||
|
||||
// 注入 kernel 实例到业务逻辑
|
||||
initApp(kernel);
|
||||
@ -754,13 +762,9 @@
|
||||
// 移除按钮事件
|
||||
document.getElementById('remove-model-btn').addEventListener('click', () => {
|
||||
const pickedMesh = window.getCurrentPickedMesh();
|
||||
console.log(pickedMesh);
|
||||
|
||||
if (pickedMesh) {
|
||||
const meshName = pickedMesh.name;
|
||||
const modelName = kernel.model.findModelNameByMesh(pickedMesh);
|
||||
console.log(modelName);
|
||||
|
||||
const success = kernel.model.removeByName(modelName);
|
||||
if (success) {
|
||||
console.log('模型已移除');
|
||||
@ -873,6 +877,13 @@
|
||||
kernel.on('model:click', (data) => {
|
||||
console.log('模型点击事件', data);
|
||||
console.log('模型控制类型:', data.modelControlType);
|
||||
|
||||
// 获取模型关联的 SKU
|
||||
const modelName = data.modelName;
|
||||
const sku = window.getSkuByModelId(modelName);
|
||||
console.log('点击的模型ID:', modelName);
|
||||
console.log('关联的SKU:', sku || '未找到关联的SKU');
|
||||
|
||||
switch (data.modelControlType) {
|
||||
case "color":
|
||||
// DOM 2D转3D 示例:点击模型时显示信息框
|
||||
|
||||
Reference in New Issue
Block a user