123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <!-- -->
- <template>
- <div class="Big-Book-prev-Textdes Sudoku" v-if="curQue">
- <div class="item-box">
- <div :class="['item']" v-for="(item,index) in curQue.option" :key="index">
- <div v-for="(items,indexs) in item" :key="indexs" :class="[indexs%3==2?'noBorder':'',indexs>5?'noBorder-bottom':'']">
- <span v-if="items.isHint">
- {{items.value}}
- </span>
- <input v-else v-model="soduko[index][indexs]" maxlength="1" @input="changeNumber(soduko[index][indexs],index,indexs)" @blur="handleCheck(index,indexs)">
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- components: {},
- props: ["curQue"],
- data() {
- return {
- soduko:[]
- };
- },
- computed: {},
- watch: {},
- //方法集合
- methods: {
- // 处理数据
- handleData(){
- let _this = this
- _this.soduko = []
- _this.curQue.option.forEach(item => {
- let arr = []
- item.forEach(items=>{
- if(items.isHint){
- arr.push(items.value)
- }else{
- arr.push('')
- }
- })
- _this.soduko.push(arr)
- });
- },
- changeNumber(item,index,indexs) {
- let value = item.replace(/[^\d]/g, "")
- this.$set(this.soduko[index],indexs,value)
- },
- // 校验输入内容是否已有
- handleCheck(index,indexs){
-
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- this.handleData()
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {},
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='scss' scoped>
- //@import url(); 引入公共css类
- .Big-Book-prev-Textdes{
- .item-box{
- display: flex;
- flex-flow: wrap;
- width: 544px;
- border-bottom: 1px solid #484848;
- border-right: 1px solid #484848;
- .item{
- display: flex;
- flex-flow: wrap;
- width: 181px;
- height: 181px;
- border-top: 1px solid #484848;
- border-left: 1px solid #484848;
- box-sizing: border-box;
- div{
- width: 60px;
- height: 60px;
- display: flex;
- justify-content: center;
- align-items: center;
- border-bottom: 1px solid #D1D1D1;
- border-right: 1px solid #D1D1D1;
- box-sizing: border-box;
- &.noBorder{
- border-right: none;
- }
- &.noBorder-bottom{
- border-bottom: none;
- }
- span{
- font-size: 20px;
- line-height: 150%;
- color: #32A5D8;
- font-family: 'robot';
- }
- input{
- width: 100%;
- height: 100%;
- border: none;
- outline: none;
- text-align: center;
- color: #000000;
- font-size: 20px;
- font-weight: 500;
- font-family: 'robot';
- }
- }
- }
- }
- }
- </style>
|